Systema77/sheetsage2-demo
0
1---2title: SheetSage2 Demo3emoji: ๐ผ4colorFrom: indigo5colorTo: pink6sdk: gradio7sdk_version: 4.44.18app_file: app.py9pinned: false10license: cc-by-nc-4.011python_version: "3.10"12---13 14# SheetSage2 demo15 16Upload (or record) a music clip and get back a transcription from17[`m-a-p/SheetSage2`](https://huggingface.co/m-a-p/SheetSage2): ABC notation,18timed `.lab` annotations, MIDI, and โ when the model writes them โ rendered19sheet-music/preview files.20 21## โ ๏ธ Before you deploy this, please read22 23This Space was assembled **without being able to reach huggingface.co** from24the sandbox that built it (the network egress policy there blocks the25`huggingface.co` domain entirely โ confirmed, not assumed). So:26 27- The app code below is written from `m-a-p/SheetSage2`'s **publicly28 reported API** (found via web search, not by reading the model card29 directly): `AutoModel.from_pretrained("m-a-p/SheetSage2", trust_remote_code=True)`30 and a `.transcribe(audio, output_dir=...)` method returning ABC / MIDI /31 events / per-part MIDIs / `.lab` text, plus rendered files on disk when32 `output_dir` is given. **It has not been run end-to-end against the real33 model.** Please smoke-test it once on your own Space before relying on it.34- **`m-a-p/SheetSage2` is gated and built on `MERT-v2-FullSong`, which is35 also gated.** You (the account behind this Space) need to have been36 granted access to *both* repos on the Hub, and the Space needs an37 `HF_TOKEN` secret with that access โ set it under38 *Space โ Settings โ Variables and secrets*.39- The model needs a real GPU in practice (it's a full transcription40 pipeline, not a toy). This app defaults to CPU and will be slow-to-broken41 there; it includes an optional [ZeroGPU](https://huggingface.co/docs/hub/spaces-zerogpu)42 hook (the `spaces` package) โ enable it if you deploy on a ZeroGPU Space,43 or otherwise pick a GPU hardware tier.44- The model reportedly needs **FFmpeg 6.1** specifically. `packages.txt`45 below asks apt for `ffmpeg`, but the base Space image's apt repo may ship46 an older/newer build. If transcription fails with an ffmpeg-related error,47 that's the first thing to check.48- SheetSage2 almost certainly has its own `requirements.txt` in its repo49 (referenced by third-party writeups) that pins extra dependencies50 (likely something in the music21/pretty_midi/librosa/soundfile family for51 rendering). **I could not fetch that file**, so `requirements.txt` here52 only has the dependencies that were actually documented53 (`torch==2.8.0`, `torchaudio==2.8.0`, `huggingface-hub==0.36.0`) plus the54 obvious Gradio/transformers stack. **Open the real55 `requirements.txt` at <https://huggingface.co/m-a-p/SheetSage2/tree/main>56 and merge anything missing in before you deploy.**57 58None of this is a reason not to ship it โ it's the honest list of what to59verify once you (or a session with Hub access) can actually reach the60model.61 62## Deploying63 64This directory was built locally and was **not** pushed to the Hub (same65network restriction as above). To deploy:66 67```bash68# from this directory69huggingface-cli login # or set HF_TOKEN70huggingface-cli repo create sheetsage2-demo --type space --space_sdk gradio71git init72git remote add space https://huggingface.co/spaces/<your-username>/sheetsage2-demo73git add .74git commit -m "Initial SheetSage2 demo"75git push space main76```77 78or just drag-and-drop these files into a new Space via the web UI.79 80Then set the `HF_TOKEN` secret (Settings โ Variables and secrets) to a81token from an account with access to `m-a-p/SheetSage2` and its82`MERT-v2-FullSong` base model.83 84## Files85 86- `app.py` โ the Gradio interface87- `requirements.txt` โ Python dependencies88- `packages.txt` โ apt packages (ffmpeg)89 