Eddycrack864 commited on
Commit
ca61a05
β€’
1 Parent(s): 6a9e2e4

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -5
app.py CHANGED
@@ -120,7 +120,7 @@ demucs_overlap_values = [
120
  '0.99',
121
  ]
122
 
123
- def roformer_separator(roformer_audio, roformer_model, roformer_output_format, roformer_overlap):
124
  files_list = []
125
  files_list.clear()
126
  directory = "./outputs"
@@ -129,7 +129,7 @@ def roformer_separator(roformer_audio, roformer_model, roformer_output_format, r
129
  os.makedirs("outputs", exist_ok=True)
130
  write(f'{random_id}.wav', roformer_audio[0], roformer_audio[1])
131
  full_roformer_model = roformer_models[roformer_model]
132
- 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}"
133
  os.system(prompt)
134
 
135
  for file in os.listdir(directory):
@@ -141,7 +141,7 @@ def roformer_separator(roformer_audio, roformer_model, roformer_output_format, r
141
 
142
  return stem1_file, stem2_file
143
 
144
- def mdxc_separator(mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segment_size, mdx23c_overlap):
145
  files_list = []
146
  files_list.clear()
147
  directory = "./outputs"
@@ -150,6 +150,10 @@ def mdxc_separator(mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segm
150
  os.makedirs("outputs", exist_ok=True)
151
  write(f'{random_id}.wav', mdx23c_audio[0], mdx23c_audio[1])
152
  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}"
 
 
 
 
153
  os.system(prompt)
154
 
155
  for file in os.listdir(directory):
@@ -261,6 +265,15 @@ with gr.Blocks(theme="NoCrypt/miku@1.2.2", title="🎡 UVR5 UI 🎡") as app:
261
  value = 4,
262
  interactive = True
263
  )
 
 
 
 
 
 
 
 
 
264
  with gr.Row():
265
  roformer_audio = gr.Audio(
266
  label = "Input Audio",
@@ -283,7 +296,7 @@ with gr.Blocks(theme="NoCrypt/miku@1.2.2", title="🎡 UVR5 UI 🎡") as app:
283
  type = "filepath"
284
  )
285
 
286
- roformer_button.click(roformer_separator, [roformer_audio, roformer_model, roformer_output_format, roformer_overlap], [roformer_stem1, roformer_stem2])
287
 
288
  with gr.TabItem("MDX23C"):
289
  with gr.Row():
@@ -316,6 +329,12 @@ with gr.Blocks(theme="NoCrypt/miku@1.2.2", title="🎡 UVR5 UI 🎡") as app:
316
  value = 8,
317
  interactive = True
318
  )
 
 
 
 
 
 
319
  with gr.Row():
320
  mdx23c_audio = gr.Audio(
321
  label = "Input Audio",
@@ -338,7 +357,7 @@ with gr.Blocks(theme="NoCrypt/miku@1.2.2", title="🎡 UVR5 UI 🎡") as app:
338
  type = "filepath"
339
  )
340
 
341
- mdx23c_button.click(mdxc_separator, [mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segment_size, mdx23c_overlap], [mdx23c_stem1, mdx23c_stem2])
342
 
343
  with gr.TabItem("MDX-NET"):
344
  with gr.Row():
 
120
  '0.99',
121
  ]
122
 
123
+ def roformer_separator(roformer_audio, roformer_model, roformer_output_format, roformer_overlap, roformer_segment_size):
124
  files_list = []
125
  files_list.clear()
126
  directory = "./outputs"
 
129
  os.makedirs("outputs", exist_ok=True)
130
  write(f'{random_id}.wav', roformer_audio[0], roformer_audio[1])
131
  full_roformer_model = roformer_models[roformer_model]
132
+ 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}"
133
  os.system(prompt)
134
 
135
  for file in os.listdir(directory):
 
141
 
142
  return stem1_file, stem2_file
143
 
144
+ def mdxc_separator(mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segment_size, mdx23c_overlap, mdx23c_denoise):
145
  files_list = []
146
  files_list.clear()
147
  directory = "./outputs"
 
150
  os.makedirs("outputs", exist_ok=True)
151
  write(f'{random_id}.wav', mdx23c_audio[0], mdx23c_audio[1])
152
  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}"
153
+
154
+ if mdx23c_denoise:
155
+ prompt += " --mdx_enable_denoise"
156
+
157
  os.system(prompt)
158
 
159
  for file in os.listdir(directory):
 
265
  value = 4,
266
  interactive = True
267
  )
268
+ roformer_segment_size = gr.Slider(
269
+ minimum = 32,
270
+ maximum = 4000,
271
+ step = 32,
272
+ label = "Segment Size",
273
+ info = "Larger consumes more resources, but may give better results.",
274
+ value = 256,
275
+ interactive = True
276
+ )
277
  with gr.Row():
278
  roformer_audio = gr.Audio(
279
  label = "Input Audio",
 
296
  type = "filepath"
297
  )
298
 
299
+ roformer_button.click(roformer_separator, [roformer_audio, roformer_model, roformer_output_format, roformer_overlap, roformer_segment_size], [roformer_stem1, roformer_stem2])
300
 
301
  with gr.TabItem("MDX23C"):
302
  with gr.Row():
 
329
  value = 8,
330
  interactive = True
331
  )
332
+ mdx23c_denoise = gr.Checkbox(
333
+ label = "Denoise",
334
+ info = "Enable denoising during separation.",
335
+ value = False,
336
+ interactive = True
337
+ )
338
  with gr.Row():
339
  mdx23c_audio = gr.Audio(
340
  label = "Input Audio",
 
357
  type = "filepath"
358
  )
359
 
360
+ mdx23c_button.click(mdxc_separator, [mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segment_size, mdx23c_overlap, mdx23c_denoise], [mdx23c_stem1, mdx23c_stem2])
361
 
362
  with gr.TabItem("MDX-NET"):
363
  with gr.Row():