--- title: Bytley Stems emoji: πŸŽ›οΈ colorFrom: purple colorTo: pink sdk: docker app_port: 7860 pinned: false --- # Bytley Demucs stem-separation backend FastAPI service that splits a song into stems with **Demucs (htdemucs)** on the free Hugging Face CPU tier. Same deployment pattern as the PDFβ†’Word Space. ## Endpoints - `GET /` β€” health: `{ok, service, model, maxMb}` - `POST /separate?mode=stems` β€” multipart `file` β†’ ZIP of `vocals.mp3, drums.mp3, bass.mp3, other.mp3` - `POST /separate?mode=karaoke` β€” β†’ ZIP of `instrumental.mp3, vocals.mp3` ## Deploy (Hugging Face Spaces) 1. huggingface.co β†’ New Space β†’ name `bytley-stems` β†’ SDK: **Docker** β†’ CPU basic (free). 2. Upload `app.py`, `requirements.txt`, `Dockerfile`, this `README.md`. 3. First build takes a while (torch + baked model β‰ˆ 1–2 GB image). Watch Build logs. 4. Health check: `https://-bytley-stems.hf.space/` β†’ `{"ok":true,...}`. 5. Put that URL in `src/consts.ts` β†’ `demucsApi: "https://-bytley-stems.hf.space/separate"`. 6. Optional: Space secret `BYTLEY_TOKEN` + same value in `consts.ts` `demucsToken`. 7. Add the health URL to your cron pinger (cron-job.org / UptimeRobot, every 30 min) so the Space never hits the 48 h sleep. ## Notes - A 3–4 min song takes roughly 4–10 min on the free 2-vCPU tier. One job at a time. - Uploads are processed in a temp dir and deleted immediately after the response. - Input capped at 30 MB / 10 minutes of audio.