TheStinger Eddycrack864 commited on
Commit
32d05d4
1 Parent(s): 028817f

New params for Roformers and MDX23C (#5)

Browse files

- New params for Roformers and MDX23C (9865bea4ae88349cd0156edcbf30f5fb0fb2dfa8)


Co-authored-by: Eddycrack 864 <Eddycrack864@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +25 -6
app.py CHANGED
@@ -122,7 +122,7 @@ demucs_overlap_values = [
122
  ]
123
 
124
  @spaces.GPU(duration=300)
125
- def roformer_separator(roformer_audio, roformer_model, roformer_output_format, roformer_overlap):
126
  files_list = []
127
  files_list.clear()
128
  directory = "./outputs"
@@ -131,7 +131,7 @@ def roformer_separator(roformer_audio, roformer_model, roformer_output_format, r
131
  os.makedirs("outputs", exist_ok=True)
132
  write(f'{random_id}.wav', roformer_audio[0], roformer_audio[1])
133
  full_roformer_model = roformer_models[roformer_model]
134
- prompt = f"audio-separator {random_id}.wav --model_filename {full_roformer_model} --output_dir=./outputs --output_format={roformer_output_format} --normalization=0.9 --mdxc_overlap={roformer_overlap}"
135
  os.system(prompt)
136
 
137
  for file in os.listdir(directory):
@@ -144,7 +144,7 @@ def roformer_separator(roformer_audio, roformer_model, roformer_output_format, r
144
  return stem1_file, stem2_file
145
 
146
  @spaces.GPU(duration=300)
147
- def mdxc_separator(mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segment_size, mdx23c_overlap):
148
  files_list = []
149
  files_list.clear()
150
  directory = "./outputs"
@@ -153,6 +153,10 @@ def mdxc_separator(mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segm
153
  os.makedirs("outputs", exist_ok=True)
154
  write(f'{random_id}.wav', mdx23c_audio[0], mdx23c_audio[1])
155
  prompt = f"audio-separator {random_id}.wav --model_filename {mdx23c_model} --output_dir=./outputs --output_format={mdx23c_output_format} --normalization=0.9 --mdxc_segment_size={mdx23c_segment_size} --mdxc_overlap={mdx23c_overlap}"
 
 
 
 
156
  os.system(prompt)
157
 
158
  for file in os.listdir(directory):
@@ -267,6 +271,15 @@ with gr.Blocks(theme="NoCrypt/miku@1.2.2", title="🎵 UVR5 UI 🎵") as app:
267
  value = 4,
268
  interactive = True
269
  )
 
 
 
 
 
 
 
 
 
270
  with gr.Row():
271
  roformer_audio = gr.Audio(
272
  label = "Input Audio",
@@ -289,7 +302,7 @@ with gr.Blocks(theme="NoCrypt/miku@1.2.2", title="🎵 UVR5 UI 🎵") as app:
289
  type = "filepath"
290
  )
291
 
292
- roformer_button.click(roformer_separator, [roformer_audio, roformer_model, roformer_output_format, roformer_overlap], [roformer_stem1, roformer_stem2])
293
 
294
  with gr.TabItem("MDX23C"):
295
  with gr.Row():
@@ -322,6 +335,12 @@ with gr.Blocks(theme="NoCrypt/miku@1.2.2", title="🎵 UVR5 UI 🎵") as app:
322
  value = 8,
323
  interactive = True
324
  )
 
 
 
 
 
 
325
  with gr.Row():
326
  mdx23c_audio = gr.Audio(
327
  label = "Input Audio",
@@ -344,7 +363,7 @@ with gr.Blocks(theme="NoCrypt/miku@1.2.2", title="🎵 UVR5 UI 🎵") as app:
344
  type = "filepath"
345
  )
346
 
347
- mdx23c_button.click(mdxc_separator, [mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segment_size, mdx23c_overlap], [mdx23c_stem1, mdx23c_stem2])
348
 
349
  with gr.TabItem("MDX-NET"):
350
  with gr.Row():
@@ -544,7 +563,7 @@ with gr.Blocks(theme="NoCrypt/miku@1.2.2", title="🎵 UVR5 UI 🎵") as app:
544
  * Special thanks to [Ilaria](https://github.com/TheStingerX) for hosting this space and help.
545
  * Thanks to [Mikus](https://github.com/cappuch) for the help with the code.
546
  * Thanks to [Nick088](https://huggingface.co/Nick088) for the help to fix roformers.
547
- * Improvements by [Blane187](https://github.com/Blane187).
548
 
549
  You can donate to the original UVR5 project here:
550
  [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/uvr5)
 
122
  ]
123
 
124
  @spaces.GPU(duration=300)
125
+ def roformer_separator(roformer_audio, roformer_model, roformer_output_format, roformer_overlap, roformer_segment_size):
126
  files_list = []
127
  files_list.clear()
128
  directory = "./outputs"
 
131
  os.makedirs("outputs", exist_ok=True)
132
  write(f'{random_id}.wav', roformer_audio[0], roformer_audio[1])
133
  full_roformer_model = roformer_models[roformer_model]
134
+ prompt = f"audio-separator {random_id}.wav --model_filename {full_roformer_model} --output_dir=./outputs --output_format={roformer_output_format} --normalization=0.9 --mdxc_overlap={roformer_overlap} --mdxc_segment_size={roformer_segment_size}"
135
  os.system(prompt)
136
 
137
  for file in os.listdir(directory):
 
144
  return stem1_file, stem2_file
145
 
146
  @spaces.GPU(duration=300)
147
+ def mdxc_separator(mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segment_size, mdx23c_overlap, mdx23c_denoise):
148
  files_list = []
149
  files_list.clear()
150
  directory = "./outputs"
 
153
  os.makedirs("outputs", exist_ok=True)
154
  write(f'{random_id}.wav', mdx23c_audio[0], mdx23c_audio[1])
155
  prompt = f"audio-separator {random_id}.wav --model_filename {mdx23c_model} --output_dir=./outputs --output_format={mdx23c_output_format} --normalization=0.9 --mdxc_segment_size={mdx23c_segment_size} --mdxc_overlap={mdx23c_overlap}"
156
+
157
+ if mdx23c_denoise:
158
+ prompt += " --mdx_enable_denoise"
159
+
160
  os.system(prompt)
161
 
162
  for file in os.listdir(directory):
 
271
  value = 4,
272
  interactive = True
273
  )
274
+ roformer_segment_size = gr.Slider(
275
+ minimum = 32,
276
+ maximum = 4000,
277
+ step = 32,
278
+ label = "Segment Size",
279
+ info = "Larger consumes more resources, but may give better results.",
280
+ value = 256,
281
+ interactive = True
282
+ )
283
  with gr.Row():
284
  roformer_audio = gr.Audio(
285
  label = "Input Audio",
 
302
  type = "filepath"
303
  )
304
 
305
+ roformer_button.click(roformer_separator, [roformer_audio, roformer_model, roformer_output_format, roformer_overlap, roformer_segment_size], [roformer_stem1, roformer_stem2])
306
 
307
  with gr.TabItem("MDX23C"):
308
  with gr.Row():
 
335
  value = 8,
336
  interactive = True
337
  )
338
+ mdx23c_denoise = gr.Checkbox(
339
+ label = "Denoise",
340
+ info = "Enable denoising during separation.",
341
+ value = False,
342
+ interactive = True
343
+ )
344
  with gr.Row():
345
  mdx23c_audio = gr.Audio(
346
  label = "Input Audio",
 
363
  type = "filepath"
364
  )
365
 
366
+ mdx23c_button.click(mdxc_separator, [mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segment_size, mdx23c_overlap, mdx23c_denoise], [mdx23c_stem1, mdx23c_stem2])
367
 
368
  with gr.TabItem("MDX-NET"):
369
  with gr.Row():
 
563
  * Special thanks to [Ilaria](https://github.com/TheStingerX) for hosting this space and help.
564
  * Thanks to [Mikus](https://github.com/cappuch) for the help with the code.
565
  * Thanks to [Nick088](https://huggingface.co/Nick088) for the help to fix roformers.
566
+ * Improvements by [Blane187](https://huggingface.co/Blane187).
567
 
568
  You can donate to the original UVR5 project here:
569
  [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/uvr5)