saumya-pailwan commited on
Commit
6926b0c
·
verified ·
1 Parent(s): 72f34b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -13
app.py CHANGED
@@ -16,20 +16,17 @@ import numpy as np
16
  model_card = ModelCard(
17
  name="Demucs Stem Separator (All Stems)",
18
  description=(
19
- "Separates a full music track into its core components using the Demucs model. \n"
20
- "Input: A stereo music mix (WAV or MP3) containing multiple instruments or vocals.\n"
21
- "Output: Four individual audio stems:- Drums, Bass, Vocals, Other-instrumental, each isolated with high fidelity for remixing or analysis. \n\n"
22
- "**Model Variants and Recommendations:**\n"
23
- "1. **htdemucs**: Best overall realism and clarity (default)\n"
24
- "2. **mdx_extra_q**: Highest vocal quality and cleaner separation\n"
25
- "3. **mdx_extra**: Balanced trade-off between speed and accuracy\n"
26
- "4. **mdx_q**: Lightweight and fast, suitable for quick previews or limited hardware\n\n"
27
  ),
28
  author="Alexandre Défossez, et al.",
29
  tags=["demucs", "source-separation", "pyharp", "stems", "multi-output"]
30
  )
31
 
32
- DEMUX_MODELS = ["mdx_extra_q", "mdx_extra", "htdemucs", "mdx_q"]
33
  STEM_NAMES = ["Drums", "Bass", "Vocals", "Other"]
34
 
35
  # Global model cache
@@ -99,6 +96,9 @@ def separate_all_stems(audio_file_path: str, model_name: str):
99
 
100
  # Process Function
101
  def process_fn(audio_file_path, model_name):
 
 
 
102
  output_signals = separate_all_stems(audio_file_path, model_name)
103
 
104
  is_mp3 = Path(audio_file_path).suffix.lower() == ".mp3"
@@ -124,10 +124,9 @@ with gr.Blocks() as demo:
124
  value="htdemucs",
125
  info=(
126
  "Choose which Demucs variant to use for separation:\n"
127
- "1. htdemucs: Best overall quality and realism (default).\n"
128
- "2. mdx_extra_q: High-quality extended model trained for cleaner vocals.\n"
129
- "3. mdx_extra: Balanced version with good speed and quality.\n"
130
- "4. mdx_q: Faster, lighter model for quick previews or low-end devices."
131
  )
132
  )
133
 
 
16
  model_card = ModelCard(
17
  name="Demucs Stem Separator (All Stems)",
18
  description=(
19
+ "Separates a full music track into four individual audio stems- Drums, Bass, Vocals, Other-instrumental using the Demucs model. \n"
20
+ "Available Model Variants:\n"
21
+ "1. htdemucs: Best overall fidelity and natural sound (default) \n"
22
+ "2. mdx_extra: Balanced trade-off, faster processing with only a small drop in quality. \n"
23
+ "3. mdx_extra_q: Fastest and lightest, noticeable quality loss, ideal for quick previews. \n"
 
 
 
24
  ),
25
  author="Alexandre Défossez, et al.",
26
  tags=["demucs", "source-separation", "pyharp", "stems", "multi-output"]
27
  )
28
 
29
+ DEMUX_MODELS = ["htdemucs", "mdx_extra", "mdx_extra_q"]
30
  STEM_NAMES = ["Drums", "Bass", "Vocals", "Other"]
31
 
32
  # Global model cache
 
96
 
97
  # Process Function
98
  def process_fn(audio_file_path, model_name):
99
+ if model_name not in DEMUX_MODELS:
100
+ raise ValueError(f"Unsupported model selected: {model_name}")
101
+
102
  output_signals = separate_all_stems(audio_file_path, model_name)
103
 
104
  is_mp3 = Path(audio_file_path).suffix.lower() == ".mp3"
 
124
  value="htdemucs",
125
  info=(
126
  "Choose which Demucs variant to use for separation:\n"
127
+ "1. htdemucs: High-quality Hybrid Transformer Demucs trained on MusDB + 800 songs.\n"
128
+ "2. mdx_extra: Trained with extended data. Balanced model offering a clear trade-off between quality and speed.\n"
129
+ "3. mdx_extra_q: Quantized lightweight version of mdx_extra.\n"
 
130
  )
131
  )
132