File size: 2,477 Bytes
c7e34b8
 
82a1838
 
 
c7e34b8
82a1838
 
 
36e50f2
 
 
 
c7e34b8
36e50f2
c7e34b8
 
36e50f2
82a1838
36e50f2
efd6804
 
 
82a1838
36e50f2
82a1838
36e50f2
 
 
 
 
 
 
 
2cfca39
36e50f2
 
 
 
 
 
93b168d
 
 
 
36e50f2
 
 
 
 
 
 
 
 
 
 
 
18eff79
 
 
 
2cfca39
 
 
 
 
18eff79
2cfca39
 
 
 
 
 
 
18eff79
2cfca39
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
title: SeparateTracks
emoji: 🎼
colorFrom: red
colorTo: yellow
sdk: docker
sdk_version: 6.13.0
app_file: app.py
tags:
- audio
- music
- tools
- MCP
pinned: false
short_description: Separate tracks from mixed audio
---

Check out the configuration reference at <https://huggingface.co/docs/hub/spaces-config-reference>

## SeparateTracks

Download audio from YouTube, separate it into instrument stems with Demucs,
and view the results in a Gradio AudioGallery UI with MCP support.

## Features

- Accepts either a raw YouTube video ID or a full YouTube URL.
- Accepts `.wav` or `.mp3` uploads as a local audio override for separation.
- Builds a 7-track output gallery for drums, vocals, guitar, bass, other,
   piano, and combined music, with a download link under each play button.
- Exposes an MCP endpoint at `/gradio_api/mcp/sse`.

## Usage

Run the app locally (not admin):

```bash
pip install -r requirements.txt
python app.py
```

```debugging
py -m app -Xfrozen_modules=off
```

Then open `http://localhost:7860` and use one of these flows:

1. Paste a YouTube video ID or full URL into `YouTube Video ID or URL` and
   click `Separate Tracks`.
2. Upload a `.wav` or `.mp3` file into `Audio File Override (.wav or .mp3)`
   and click `Separate Tracks`.

If an upload is present, it takes precedence over the YouTube field.

## Outputs

Separated files are written under `separated/htdemucs_6s/{job_id}/`.
For YouTube sources, `job_id` is the sanitized video title when available,
falling back to the video ID. For uploaded audio, `job_id` is a sanitized
version of the uploaded filename stem. Each stem card in the gallery can be
played in place or downloaded directly.

## Extractors & Cookies

For details about yt-dlp extractor behavior, see the official documentation:

- <https://github.com/yt-dlp/yt-dlp-wiki/blob/master/Extractors.md>

If you need authenticated extraction (for age-restricted or otherwise protected
content), one way to provide cookies safely is via a private/incognito browser
session:

1. Open a new private browsing/incognito window and log into YouTube.
2. In the same window and same tab from step 1, navigate to
   <https://www.youtube.com/robots.txt> (this should be the only
   private/incognito browsing tab open).
3. Export youtube.com cookies from the browser, then close the private/
   incognito window so that the session is never opened in the browser again.

Upload the exported cookies file in the app UI when prompted.