Politrees commited on
Commit
d907ae6
·
verified ·
1 Parent(s): c62e67d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +98 -37
app.py CHANGED
@@ -4,7 +4,7 @@ import shutil
4
  import logging
5
  import gradio as gr
6
 
7
- from audio_separator.separator import Separator
8
 
9
  device = "cuda" if torch.cuda.is_available() else "cpu"
10
  use_autocast = device == "cuda"
@@ -13,15 +13,15 @@ use_autocast = device == "cuda"
13
  # Roformer Models #
14
  #=========================#
15
  ROFORMER_MODELS = {
16
- 'BS-Roformer-De-Reverb': 'deverb_bs_roformer_8_384dim_10depth.ckpt',
17
  'BS-Roformer-Viperx-1053': 'model_bs_roformer_ep_937_sdr_10.5309.ckpt',
18
  'BS-Roformer-Viperx-1296': 'model_bs_roformer_ep_368_sdr_12.9628.ckpt',
19
  'BS-Roformer-Viperx-1297': 'model_bs_roformer_ep_317_sdr_12.9755.ckpt',
 
 
20
  'Mel-Roformer-Crowd-Aufr33-Viperx': 'mel_band_roformer_crowd_aufr33_viperx_sdr_8.7144.ckpt',
 
21
  'Mel-Roformer-Denoise-Aufr33': 'denoise_mel_band_roformer_aufr33_sdr_27.9959.ckpt',
22
  'Mel-Roformer-Denoise-Aufr33-Aggr': 'denoise_mel_band_roformer_aufr33_aggr_sdr_27.9768.ckpt',
23
- 'Mel-Roformer-Karaoke-Aufr33-Viperx': 'mel_band_roformer_karaoke_aufr33_viperx_sdr_10.1956.ckpt',
24
- 'Mel-Roformer-Viperx-1143': 'model_mel_band_roformer_ep_3005_sdr_11.4360.ckpt',
25
  'MelBand Roformer Kim | Inst V1 by Unwa': 'melband_roformer_inst_v1.ckpt',
26
  'MelBand Roformer Kim | Inst V2 by Unwa': 'melband_roformer_inst_v2.ckpt',
27
  'MelBand Roformer Kim | InstVoc Duality V1 by Unwa': 'melband_roformer_instvoc_duality_v1.ckpt',
@@ -39,7 +39,6 @@ MDX23C_MODELS = [
39
  # MDXN-NET Models #
40
  #=========================#
41
  MDXNET_MODELS = [
42
- 'UVR-MDX-NET-Crowd_HQ_1.onnx',
43
  'UVR-MDX-NET-Inst_1.onnx',
44
  'UVR-MDX-NET-Inst_2.onnx',
45
  'UVR-MDX-NET-Inst_3.onnx',
@@ -48,16 +47,17 @@ MDXNET_MODELS = [
48
  'UVR-MDX-NET-Inst_HQ_3.onnx',
49
  'UVR-MDX-NET-Inst_HQ_4.onnx',
50
  'UVR-MDX-NET-Inst_HQ_5.onnx',
51
- 'UVR-MDX-NET-Inst_full_292.onnx',
52
- 'UVR-MDX-NET-Voc_FT.onnx',
53
  'UVR-MDX-NET_Inst_82_beta.onnx',
54
  'UVR-MDX-NET_Inst_90_beta.onnx',
55
  'UVR-MDX-NET_Inst_187_beta.onnx',
 
56
  'UVR-MDX-NET_Main_340.onnx',
57
  'UVR-MDX-NET_Main_390.onnx',
58
  'UVR-MDX-NET_Main_406.onnx',
59
  'UVR-MDX-NET_Main_427.onnx',
60
  'UVR-MDX-NET_Main_438.onnx',
 
 
61
  'UVR_MDXNET_1_9703.onnx',
62
  'UVR_MDXNET_2_9682.onnx',
63
  'UVR_MDXNET_3_9662.onnx',
@@ -124,7 +124,7 @@ def print_message(input_file, model_name):
124
  """Prints information about the audio separation process."""
125
  base_name = os.path.splitext(os.path.basename(input_file))[0]
126
  print("\n")
127
- print("🎵 Audio-Separator 🎵")
128
  print("Input audio:", base_name)
129
  print("Separation Model:", model_name)
130
  print("Audio Separation Process...")
@@ -141,9 +141,22 @@ def prepare_output_dir(input_file, output_dir):
141
  raise RuntimeError(f"Failed to prepare output directory {out_dir}: {e}")
142
  return out_dir
143
 
144
- def roformer_separator(audio, model_key, seg_size, override_seg_size, overlap, pitch_shift, model_dir, out_dir, out_format, norm_thresh, amp_thresh, batch_size, progress=gr.Progress(track_tqdm=True)):
145
- """Separate audio using Roformer model."""
146
  base_name = os.path.splitext(os.path.basename(audio))[0]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  print_message(audio, model_key)
148
  model = ROFORMER_MODELS[model_key]
149
  try:
@@ -169,17 +182,17 @@ def roformer_separator(audio, model_key, seg_size, override_seg_size, overlap, p
169
  separator.load_model(model_filename=model)
170
 
171
  progress(0.7, desc="Audio separated...")
172
- separation = separator.separate(audio, f"{base_name}_(Stem1)", f"{base_name}_(Stem2)")
173
  print(f"Separation complete!\nResults: {', '.join(separation)}")
174
 
175
  stems = [os.path.join(out_dir, file_name) for file_name in separation]
176
- return stems[1], stems[0]
177
  except Exception as e:
178
  raise RuntimeError(f"Roformer separation failed: {e}") from e
179
 
180
- def mdx23c_separator(audio, model, seg_size, override_seg_size, overlap, pitch_shift, model_dir, out_dir, out_format, norm_thresh, amp_thresh, batch_size, progress=gr.Progress(track_tqdm=True)):
181
  """Separate audio using MDX23C model."""
182
- base_name = os.path.splitext(os.path.basename(audio))[0]
183
  print_message(audio, model)
184
  try:
185
  out_dir = prepare_output_dir(audio, out_dir)
@@ -204,17 +217,17 @@ def mdx23c_separator(audio, model, seg_size, override_seg_size, overlap, pitch_s
204
  separator.load_model(model_filename=model)
205
 
206
  progress(0.7, desc="Audio separated...")
207
- separation = separator.separate(audio, f"{base_name}_(Stem1)", f"{base_name}_(Stem2)")
208
  print(f"Separation complete!\nResults: {', '.join(separation)}")
209
 
210
  stems = [os.path.join(out_dir, file_name) for file_name in separation]
211
- return stems[1], stems[0]
212
  except Exception as e:
213
  raise RuntimeError(f"MDX23C separation failed: {e}") from e
214
 
215
- def mdx_separator(audio, model, hop_length, seg_size, overlap, denoise, model_dir, out_dir, out_format, norm_thresh, amp_thresh, batch_size, progress=gr.Progress(track_tqdm=True)):
216
  """Separate audio using MDX-NET model."""
217
- base_name = os.path.splitext(os.path.basename(audio))[0]
218
  print_message(audio, model)
219
  try:
220
  out_dir = prepare_output_dir(audio, out_dir)
@@ -239,7 +252,7 @@ def mdx_separator(audio, model, hop_length, seg_size, overlap, denoise, model_di
239
  separator.load_model(model_filename=model)
240
 
241
  progress(0.7, desc="Audio separated...")
242
- separation = separator.separate(audio, f"{base_name}_(Stem1)", f"{base_name}_(Stem2)")
243
  print(f"Separation complete!\nResults: {', '.join(separation)}")
244
 
245
  stems = [os.path.join(out_dir, file_name) for file_name in separation]
@@ -247,9 +260,9 @@ def mdx_separator(audio, model, hop_length, seg_size, overlap, denoise, model_di
247
  except Exception as e:
248
  raise RuntimeError(f"MDX-NET separation failed: {e}") from e
249
 
250
- def vr_separator(audio, model, window_size, aggression, tta, post_process, post_process_threshold, high_end_process, model_dir, out_dir, out_format, norm_thresh, amp_thresh, batch_size, progress=gr.Progress(track_tqdm=True)):
251
  """Separate audio using VR ARCH model."""
252
- base_name = os.path.splitext(os.path.basename(audio))[0]
253
  print_message(audio, model)
254
  try:
255
  out_dir = prepare_output_dir(audio, out_dir)
@@ -276,7 +289,7 @@ def vr_separator(audio, model, window_size, aggression, tta, post_process, post_
276
  separator.load_model(model_filename=model)
277
 
278
  progress(0.7, desc="Audio separated...")
279
- separation = separator.separate(audio, f"{base_name}_(Stem1)", f"{base_name}_(Stem2)")
280
  print(f"Separation complete!\nResults: {', '.join(separation)}")
281
 
282
  stems = [os.path.join(out_dir, file_name) for file_name in separation]
@@ -284,8 +297,9 @@ def vr_separator(audio, model, window_size, aggression, tta, post_process, post_
284
  except Exception as e:
285
  raise RuntimeError(f"VR ARCH separation failed: {e}") from e
286
 
287
- def demucs_separator(audio, model, seg_size, shifts, overlap, segments_enabled, model_dir, out_dir, out_format, norm_thresh, amp_thresh, progress=gr.Progress(track_tqdm=True)):
288
  """Separate audio using Demucs model."""
 
289
  print_message(audio, model)
290
  try:
291
  out_dir = prepare_output_dir(audio, out_dir)
@@ -309,7 +323,7 @@ def demucs_separator(audio, model, seg_size, shifts, overlap, segments_enabled,
309
  separator.load_model(model_filename=model)
310
 
311
  progress(0.7, desc="Audio separated...")
312
- separation = separator.separate(audio)
313
  print(f"Separation complete!\nResults: {', '.join(separation)}")
314
 
315
  stems = [os.path.join(out_dir, file_name) for file_name in separation]
@@ -328,15 +342,15 @@ def update_stems(model):
328
  return gr.update(visible=False)
329
 
330
  with gr.Blocks(
331
- title="🎵 Audio-Separator 🎵",
332
  css="footer{display:none !important}",
333
  theme=gr.themes.Default(
334
  spacing_size="sm",
335
  radius_size="lg",
336
  )
337
  ) as app:
338
- gr.HTML("<h1> 🎵 Audio-Separator 🎵 </h1>")
339
-
340
  with gr.Tab("Roformer"):
341
  with gr.Group():
342
  with gr.Row():
@@ -430,20 +444,32 @@ with gr.Blocks(
430
  demucs_stem5 = gr.Audio(label="Stem 5", type="filepath", interactive=False)
431
  demucs_stem6 = gr.Audio(label="Stem 6", type="filepath", interactive=False)
432
 
433
-
434
- with gr.Tab("General settings"):
435
- with gr.Group():
436
- model_file_dir = gr.Textbox(value="/tmp/audio-separator-models/", label="Directory to cache model files", info="The directory where model files are stored.", placeholder="/tmp/audio-separator-models/")
 
 
 
 
 
 
 
 
 
 
 
437
  with gr.Row():
438
- output_dir = gr.Textbox(value="output", label="File output directory", info="The directory where output files will be saved.", placeholder="output")
439
- output_format = gr.Dropdown(value="wav", choices=["wav", "flac", "mp3"], label="Output Format", info="The format of the output audio file.")
 
440
  with gr.Row():
441
- norm_threshold = gr.Slider(minimum=0.1, maximum=1, step=0.1, value=0.9, label="Normalization threshold", info="The threshold for audio normalization.")
442
- amp_threshold = gr.Slider(minimum=0.1, maximum=1, step=0.1, value=0.6, label="Amplification threshold", info="The threshold for audio amplification.")
443
  with gr.Row():
444
- batch_size = gr.Slider(minimum=1, maximum=16, step=1, value=1, label="Batch Size", info="Larger consumes more RAM but may process slightly faster.")
 
445
 
446
-
447
  demucs_model.change(update_stems, inputs=[demucs_model], outputs=stem6)
448
 
449
  roformer_button.click(
@@ -461,6 +487,13 @@ with gr.Blocks(
461
  norm_threshold,
462
  amp_threshold,
463
  batch_size,
 
 
 
 
 
 
 
464
  ],
465
  outputs=[roformer_stem1, roformer_stem2],
466
  )
@@ -479,6 +512,13 @@ with gr.Blocks(
479
  norm_threshold,
480
  amp_threshold,
481
  batch_size,
 
 
 
 
 
 
 
482
  ],
483
  outputs=[mdx23c_stem1, mdx23c_stem2],
484
  )
@@ -497,6 +537,13 @@ with gr.Blocks(
497
  norm_threshold,
498
  amp_threshold,
499
  batch_size,
 
 
 
 
 
 
 
500
  ],
501
  outputs=[mdx_stem1, mdx_stem2],
502
  )
@@ -517,6 +564,13 @@ with gr.Blocks(
517
  norm_threshold,
518
  amp_threshold,
519
  batch_size,
 
 
 
 
 
 
 
520
  ],
521
  outputs=[vr_stem1, vr_stem2],
522
  )
@@ -534,6 +588,13 @@ with gr.Blocks(
534
  output_format,
535
  norm_threshold,
536
  amp_threshold,
 
 
 
 
 
 
 
537
  ],
538
  outputs=[demucs_stem1, demucs_stem2, demucs_stem3, demucs_stem4, demucs_stem5, demucs_stem6],
539
  )
 
4
  import logging
5
  import gradio as gr
6
 
7
+ from PolUVR.separator import Separator
8
 
9
  device = "cuda" if torch.cuda.is_available() else "cpu"
10
  use_autocast = device == "cuda"
 
13
  # Roformer Models #
14
  #=========================#
15
  ROFORMER_MODELS = {
 
16
  'BS-Roformer-Viperx-1053': 'model_bs_roformer_ep_937_sdr_10.5309.ckpt',
17
  'BS-Roformer-Viperx-1296': 'model_bs_roformer_ep_368_sdr_12.9628.ckpt',
18
  'BS-Roformer-Viperx-1297': 'model_bs_roformer_ep_317_sdr_12.9755.ckpt',
19
+ 'BS-Roformer-De-Reverb': 'deverb_bs_roformer_8_384dim_10depth.ckpt',
20
+ 'Mel-Roformer-Viperx-1143': 'model_mel_band_roformer_ep_3005_sdr_11.4360.ckpt',
21
  'Mel-Roformer-Crowd-Aufr33-Viperx': 'mel_band_roformer_crowd_aufr33_viperx_sdr_8.7144.ckpt',
22
+ 'Mel-Roformer-Karaoke-Aufr33-Viperx': 'mel_band_roformer_karaoke_aufr33_viperx_sdr_10.1956.ckpt',
23
  'Mel-Roformer-Denoise-Aufr33': 'denoise_mel_band_roformer_aufr33_sdr_27.9959.ckpt',
24
  'Mel-Roformer-Denoise-Aufr33-Aggr': 'denoise_mel_band_roformer_aufr33_aggr_sdr_27.9768.ckpt',
 
 
25
  'MelBand Roformer Kim | Inst V1 by Unwa': 'melband_roformer_inst_v1.ckpt',
26
  'MelBand Roformer Kim | Inst V2 by Unwa': 'melband_roformer_inst_v2.ckpt',
27
  'MelBand Roformer Kim | InstVoc Duality V1 by Unwa': 'melband_roformer_instvoc_duality_v1.ckpt',
 
39
  # MDXN-NET Models #
40
  #=========================#
41
  MDXNET_MODELS = [
 
42
  'UVR-MDX-NET-Inst_1.onnx',
43
  'UVR-MDX-NET-Inst_2.onnx',
44
  'UVR-MDX-NET-Inst_3.onnx',
 
47
  'UVR-MDX-NET-Inst_HQ_3.onnx',
48
  'UVR-MDX-NET-Inst_HQ_4.onnx',
49
  'UVR-MDX-NET-Inst_HQ_5.onnx',
 
 
50
  'UVR-MDX-NET_Inst_82_beta.onnx',
51
  'UVR-MDX-NET_Inst_90_beta.onnx',
52
  'UVR-MDX-NET_Inst_187_beta.onnx',
53
+ 'UVR-MDX-NET-Inst_full_292.onnx',
54
  'UVR-MDX-NET_Main_340.onnx',
55
  'UVR-MDX-NET_Main_390.onnx',
56
  'UVR-MDX-NET_Main_406.onnx',
57
  'UVR-MDX-NET_Main_427.onnx',
58
  'UVR-MDX-NET_Main_438.onnx',
59
+ 'UVR-MDX-NET-Crowd_HQ_1.onnx',
60
+ 'UVR-MDX-NET-Voc_FT.onnx',
61
  'UVR_MDXNET_1_9703.onnx',
62
  'UVR_MDXNET_2_9682.onnx',
63
  'UVR_MDXNET_3_9662.onnx',
 
124
  """Prints information about the audio separation process."""
125
  base_name = os.path.splitext(os.path.basename(input_file))[0]
126
  print("\n")
127
+ print("🎵 PolUVR 🎵")
128
  print("Input audio:", base_name)
129
  print("Separation Model:", model_name)
130
  print("Audio Separation Process...")
 
141
  raise RuntimeError(f"Failed to prepare output directory {out_dir}: {e}")
142
  return out_dir
143
 
144
+ def rename_stems(audio, vocals_stem, instrumental_stem, other_stem, drums_stem, bass_stem, guitar_stem, piano_stem):
 
145
  base_name = os.path.splitext(os.path.basename(audio))[0]
146
+ stems = {
147
+ "Vocals": vocals_stem.replace("{base_name}", base_name),
148
+ "Instrumental": instrumental_stem.replace("{base_name}", base_name),
149
+ "Drums": drums_stem.replace("{base_name}", base_name),
150
+ "Bass": bass_stem.replace("{base_name}", base_name),
151
+ "Other": other_stem.replace("{base_name}", base_name),
152
+ "Guitar": guitar_stem.replace("{base_name}", base_name),
153
+ "Piano": piano_stem.replace("{base_name}", base_name),
154
+ }
155
+ return stems
156
+
157
+ def roformer_separator(audio, model_key, seg_size, override_seg_size, overlap, pitch_shift, model_dir, out_dir, out_format, norm_thresh, amp_thresh, batch_size, vocals_stem, instrumental_stem, other_stem, drums_stem, bass_stem, guitar_stem, piano_stem, progress=gr.Progress(track_tqdm=True)):
158
+ """Separate audio using Roformer model."""
159
+ stemname = rename_stems(audio, vocals_stem, instrumental_stem, other_stem, drums_stem, bass_stem, guitar_stem, piano_stem)
160
  print_message(audio, model_key)
161
  model = ROFORMER_MODELS[model_key]
162
  try:
 
182
  separator.load_model(model_filename=model)
183
 
184
  progress(0.7, desc="Audio separated...")
185
+ separation = separator.separate(audio, stemname)
186
  print(f"Separation complete!\nResults: {', '.join(separation)}")
187
 
188
  stems = [os.path.join(out_dir, file_name) for file_name in separation]
189
+ return stems[0], stems[1]
190
  except Exception as e:
191
  raise RuntimeError(f"Roformer separation failed: {e}") from e
192
 
193
+ def mdx23c_separator(audio, model, seg_size, override_seg_size, overlap, pitch_shift, model_dir, out_dir, out_format, norm_thresh, amp_thresh, batch_size, vocals_stem, instrumental_stem, other_stem, drums_stem, bass_stem, guitar_stem, piano_stem, progress=gr.Progress(track_tqdm=True)):
194
  """Separate audio using MDX23C model."""
195
+ stemname = rename_stems(audio, vocals_stem, instrumental_stem, other_stem, drums_stem, bass_stem, guitar_stem, piano_stem)
196
  print_message(audio, model)
197
  try:
198
  out_dir = prepare_output_dir(audio, out_dir)
 
217
  separator.load_model(model_filename=model)
218
 
219
  progress(0.7, desc="Audio separated...")
220
+ separation = separator.separate(audio, stemname)
221
  print(f"Separation complete!\nResults: {', '.join(separation)}")
222
 
223
  stems = [os.path.join(out_dir, file_name) for file_name in separation]
224
+ return stems[0], stems[1]
225
  except Exception as e:
226
  raise RuntimeError(f"MDX23C separation failed: {e}") from e
227
 
228
+ def mdx_separator(audio, model, hop_length, seg_size, overlap, denoise, model_dir, out_dir, out_format, norm_thresh, amp_thresh, batch_size, vocals_stem, instrumental_stem, other_stem, drums_stem, bass_stem, guitar_stem, piano_stem, progress=gr.Progress(track_tqdm=True)):
229
  """Separate audio using MDX-NET model."""
230
+ stemname = rename_stems(audio, vocals_stem, instrumental_stem, other_stem, drums_stem, bass_stem, guitar_stem, piano_stem)
231
  print_message(audio, model)
232
  try:
233
  out_dir = prepare_output_dir(audio, out_dir)
 
252
  separator.load_model(model_filename=model)
253
 
254
  progress(0.7, desc="Audio separated...")
255
+ separation = separator.separate(audio, stemname)
256
  print(f"Separation complete!\nResults: {', '.join(separation)}")
257
 
258
  stems = [os.path.join(out_dir, file_name) for file_name in separation]
 
260
  except Exception as e:
261
  raise RuntimeError(f"MDX-NET separation failed: {e}") from e
262
 
263
+ def vr_separator(audio, model, window_size, aggression, tta, post_process, post_process_threshold, high_end_process, model_dir, out_dir, out_format, norm_thresh, amp_thresh, batch_size, vocals_stem, instrumental_stem, other_stem, drums_stem, bass_stem, guitar_stem, piano_stem, progress=gr.Progress(track_tqdm=True)):
264
  """Separate audio using VR ARCH model."""
265
+ stemname = rename_stems(audio, vocals_stem, instrumental_stem, other_stem, drums_stem, bass_stem, guitar_stem, piano_stem)
266
  print_message(audio, model)
267
  try:
268
  out_dir = prepare_output_dir(audio, out_dir)
 
289
  separator.load_model(model_filename=model)
290
 
291
  progress(0.7, desc="Audio separated...")
292
+ separation = separator.separate(audio, stemname)
293
  print(f"Separation complete!\nResults: {', '.join(separation)}")
294
 
295
  stems = [os.path.join(out_dir, file_name) for file_name in separation]
 
297
  except Exception as e:
298
  raise RuntimeError(f"VR ARCH separation failed: {e}") from e
299
 
300
+ def demucs_separator(audio, model, seg_size, shifts, overlap, segments_enabled, model_dir, out_dir, out_format, norm_thresh, amp_thresh, vocals_stem, instrumental_stem, other_stem, drums_stem, bass_stem, guitar_stem, piano_stem, progress=gr.Progress(track_tqdm=True)):
301
  """Separate audio using Demucs model."""
302
+ stemname = rename_stems(audio, vocals_stem, instrumental_stem, other_stem, drums_stem, bass_stem, guitar_stem, piano_stem)
303
  print_message(audio, model)
304
  try:
305
  out_dir = prepare_output_dir(audio, out_dir)
 
323
  separator.load_model(model_filename=model)
324
 
325
  progress(0.7, desc="Audio separated...")
326
+ separation = separator.separate(audio, stemname)
327
  print(f"Separation complete!\nResults: {', '.join(separation)}")
328
 
329
  stems = [os.path.join(out_dir, file_name) for file_name in separation]
 
342
  return gr.update(visible=False)
343
 
344
  with gr.Blocks(
345
+ title="🎵 PolUVR 🎵",
346
  css="footer{display:none !important}",
347
  theme=gr.themes.Default(
348
  spacing_size="sm",
349
  radius_size="lg",
350
  )
351
  ) as app:
352
+ gr.HTML("<h1> 🎵 PolUVR 🎵 </h1>")
353
+
354
  with gr.Tab("Roformer"):
355
  with gr.Group():
356
  with gr.Row():
 
444
  demucs_stem5 = gr.Audio(label="Stem 5", type="filepath", interactive=False)
445
  demucs_stem6 = gr.Audio(label="Stem 6", type="filepath", interactive=False)
446
 
447
+ with gr.Tab("Settings"):
448
+ with gr.Accordion("General settings", open=False):
449
+ with gr.Group():
450
+ model_file_dir = gr.Textbox(value="/tmp/PolUVR-models/", label="Directory to cache model files", info="The directory where model files are stored.", placeholder="/tmp/PolUVR-models/")
451
+ with gr.Row():
452
+ output_dir = gr.Textbox(value="output", label="File output directory", info="The directory where output files will be saved.", placeholder="output")
453
+ output_format = gr.Dropdown(value="wav", choices=["wav", "flac", "mp3"], label="Output Format", info="The format of the output audio file.")
454
+ with gr.Row():
455
+ norm_threshold = gr.Slider(minimum=0.1, maximum=1, step=0.1, value=0.9, label="Normalization threshold", info="The threshold for audio normalization.")
456
+ amp_threshold = gr.Slider(minimum=0.1, maximum=1, step=0.1, value=0.6, label="Amplification threshold", info="The threshold for audio amplification.")
457
+ with gr.Row():
458
+ batch_size = gr.Slider(minimum=1, maximum=16, step=1, value=1, label="Batch Size", info="Larger consumes more RAM but may process slightly faster.")
459
+
460
+ with gr.Accordion("Rename Stems", open=False):
461
+ gr.HTML("<h3> `{base_name}` - input file name </h3>")
462
  with gr.Row():
463
+ vocals_stem = gr.Textbox(value="{base_name}_(Vocals)", label="Vocals Stem", placeholder="{base_name}_(Vocals)")
464
+ instrumental_stem = gr.Textbox(value="{base_name}_(Instrumental)", label="Instrumental Stem", placeholder="{base_name}_(Instrumental)")
465
+ other_stem = gr.Textbox(value="{base_name}_(Other)", label="Other Stem", placeholder="{base_name}_(Other)")
466
  with gr.Row():
467
+ drums_stem = gr.Textbox(value="{base_name}_(Drums)", label="Drums Stem", placeholder="{base_name}_(Drums)")
468
+ bass_stem = gr.Textbox(value="{base_name}_(Bass)", label="Bass Stem", placeholder="{base_name}_(Bass)")
469
  with gr.Row():
470
+ guitar_stem = gr.Textbox(value="{base_name}_(Guitar)", label="Guitar Stem", placeholder="{base_name}_(Guitar)")
471
+ piano_stem = gr.Textbox(value="{base_name}_(Piano)", label="Piano Stem", placeholder="{base_name}_(Piano)")
472
 
 
473
  demucs_model.change(update_stems, inputs=[demucs_model], outputs=stem6)
474
 
475
  roformer_button.click(
 
487
  norm_threshold,
488
  amp_threshold,
489
  batch_size,
490
+ vocals_stem,
491
+ instrumental_stem,
492
+ other_stem,
493
+ drums_stem,
494
+ bass_stem,
495
+ guitar_stem,
496
+ piano_stem,
497
  ],
498
  outputs=[roformer_stem1, roformer_stem2],
499
  )
 
512
  norm_threshold,
513
  amp_threshold,
514
  batch_size,
515
+ vocals_stem,
516
+ instrumental_stem,
517
+ other_stem,
518
+ drums_stem,
519
+ bass_stem,
520
+ guitar_stem,
521
+ piano_stem,
522
  ],
523
  outputs=[mdx23c_stem1, mdx23c_stem2],
524
  )
 
537
  norm_threshold,
538
  amp_threshold,
539
  batch_size,
540
+ vocals_stem,
541
+ instrumental_stem,
542
+ other_stem,
543
+ drums_stem,
544
+ bass_stem,
545
+ guitar_stem,
546
+ piano_stem,
547
  ],
548
  outputs=[mdx_stem1, mdx_stem2],
549
  )
 
564
  norm_threshold,
565
  amp_threshold,
566
  batch_size,
567
+ vocals_stem,
568
+ instrumental_stem,
569
+ other_stem,
570
+ drums_stem,
571
+ bass_stem,
572
+ guitar_stem,
573
+ piano_stem,
574
  ],
575
  outputs=[vr_stem1, vr_stem2],
576
  )
 
588
  output_format,
589
  norm_threshold,
590
  amp_threshold,
591
+ vocals_stem,
592
+ instrumental_stem,
593
+ other_stem,
594
+ drums_stem,
595
+ bass_stem,
596
+ guitar_stem,
597
+ piano_stem,
598
  ],
599
  outputs=[demucs_stem1, demucs_stem2, demucs_stem3, demucs_stem4, demucs_stem5, demucs_stem6],
600
  )