Update app.py
Browse files
app.py
CHANGED
@@ -8,18 +8,7 @@ import gradio as gr
|
|
8 |
import yt_dlp
|
9 |
import subprocess
|
10 |
|
11 |
-
|
12 |
-
'BS-Roformer-Viperx-1297.ckpt': 'model_bs_roformer_ep_317_sdr_12.9755.ckpt',
|
13 |
-
'BS-Roformer-Viperx-1296.ckpt': 'model_bs_roformer_ep_368_sdr_12.9628.ckpt',
|
14 |
-
'BS-Roformer-Viperx-1053.ckpt': 'model_bs_roformer_ep_937_sdr_10.5309.ckpt',
|
15 |
-
'Mel-Roformer-Viperx-1143.ckpt': 'model_mel_band_roformer_ep_3005_sdr_11.4360.ckpt'
|
16 |
-
}
|
17 |
-
|
18 |
-
mdx23c_models = [
|
19 |
-
'MDX23C_D1581.ckpt',
|
20 |
-
'MDX23C-8KFFT-InstVoc_HQ.ckpt',
|
21 |
-
'MDX23C-8KFFT-InstVoc_HQ_2.ckpt',
|
22 |
-
]
|
23 |
|
24 |
mdxnet_models = [
|
25 |
'UVR-MDX-NET-Inst_full_292.onnx',
|
@@ -62,41 +51,7 @@ mdxnet_models = [
|
|
62 |
'kuielab_b_drums.onnx',
|
63 |
]
|
64 |
|
65 |
-
vrarch_models = [
|
66 |
-
'1_HP-UVR.pth',
|
67 |
-
'2_HP-UVR.pth',
|
68 |
-
'3_HP-Vocal-UVR.pth',
|
69 |
-
'4_HP-Vocal-UVR.pth',
|
70 |
-
'5_HP-Karaoke-UVR.pth',
|
71 |
-
'6_HP-Karaoke-UVR.pth',
|
72 |
-
'7_HP2-UVR.pth',
|
73 |
-
'8_HP2-UVR.pth',
|
74 |
-
'9_HP2-UVR.pth',
|
75 |
-
'10_SP-UVR-2B-32000-1.pth',
|
76 |
-
'11_SP-UVR-2B-32000-2.pth',
|
77 |
-
'12_SP-UVR-3B-44100.pth',
|
78 |
-
'13_SP-UVR-4B-44100-1.pth',
|
79 |
-
'14_SP-UVR-4B-44100-2.pth',
|
80 |
-
'15_SP-UVR-MID-44100-1.pth',
|
81 |
-
'16_SP-UVR-MID-44100-2.pth',
|
82 |
-
'17_HP-Wind_Inst-UVR.pth',
|
83 |
-
'UVR-De-Echo-Aggressive.pth',
|
84 |
-
'UVR-De-Echo-Normal.pth',
|
85 |
-
'UVR-DeEcho-DeReverb.pth',
|
86 |
-
'UVR-DeNoise-Lite.pth',
|
87 |
-
'UVR-DeNoise.pth',
|
88 |
-
'UVR-BVE-4B_SN-44100-1.pth',
|
89 |
-
'MGM_HIGHEND_v4.pth',
|
90 |
-
'MGM_LOWEND_A_v4.pth',
|
91 |
-
'MGM_LOWEND_B_v4.pth',
|
92 |
-
'MGM_MAIN_v4.pth',
|
93 |
-
]
|
94 |
|
95 |
-
demucs_models = [
|
96 |
-
'htdemucs_ft.yaml',
|
97 |
-
'htdemucs.yaml',
|
98 |
-
'hdemucs_mmi.yaml',
|
99 |
-
]
|
100 |
|
101 |
output_format = [
|
102 |
'wav',
|
@@ -111,18 +66,7 @@ mdxnet_overlap_values = [
|
|
111 |
'0.99',
|
112 |
]
|
113 |
|
114 |
-
vrarch_window_size_values = [
|
115 |
-
'320',
|
116 |
-
'512',
|
117 |
-
'1024',
|
118 |
-
]
|
119 |
|
120 |
-
demucs_overlap_values = [
|
121 |
-
'0.25',
|
122 |
-
'0.50',
|
123 |
-
'0.75',
|
124 |
-
'0.99',
|
125 |
-
]
|
126 |
|
127 |
def download_audio(url):
|
128 |
ydl_opts = {
|
@@ -143,50 +87,6 @@ def download_audio(url):
|
|
143 |
|
144 |
return sample_rate, audio_array
|
145 |
|
146 |
-
def roformer_separator(roformer_audio, roformer_model, roformer_output_format, roformer_overlap, roformer_segment_size):
|
147 |
-
files_list = []
|
148 |
-
files_list.clear()
|
149 |
-
directory = "./outputs"
|
150 |
-
random_id = str(random.randint(10000, 99999))
|
151 |
-
pattern = f"{random_id}"
|
152 |
-
os.makedirs("outputs", exist_ok=True)
|
153 |
-
write(f'{random_id}.wav', roformer_audio[0], roformer_audio[1])
|
154 |
-
full_roformer_model = roformer_models[roformer_model]
|
155 |
-
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}"
|
156 |
-
os.system(prompt)
|
157 |
-
|
158 |
-
for file in os.listdir(directory):
|
159 |
-
if re.search(pattern, file):
|
160 |
-
files_list.append(os.path.join(directory, file))
|
161 |
-
|
162 |
-
stem1_file = files_list[0]
|
163 |
-
stem2_file = files_list[1]
|
164 |
-
|
165 |
-
return stem1_file, stem2_file
|
166 |
-
|
167 |
-
def mdxc_separator(mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segment_size, mdx23c_overlap, mdx23c_denoise):
|
168 |
-
files_list = []
|
169 |
-
files_list.clear()
|
170 |
-
directory = "./outputs"
|
171 |
-
random_id = str(random.randint(10000, 99999))
|
172 |
-
pattern = f"{random_id}"
|
173 |
-
os.makedirs("outputs", exist_ok=True)
|
174 |
-
write(f'{random_id}.wav', mdx23c_audio[0], mdx23c_audio[1])
|
175 |
-
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}"
|
176 |
-
|
177 |
-
if mdx23c_denoise:
|
178 |
-
prompt += " --mdx_enable_denoise"
|
179 |
-
|
180 |
-
os.system(prompt)
|
181 |
-
|
182 |
-
for file in os.listdir(directory):
|
183 |
-
if re.search(pattern, file):
|
184 |
-
files_list.append(os.path.join(directory, file))
|
185 |
-
|
186 |
-
stem1_file = files_list[0]
|
187 |
-
stem2_file = files_list[1]
|
188 |
-
|
189 |
-
return stem1_file, stem2_file
|
190 |
|
191 |
def mdxnet_separator(mdxnet_audio, mdxnet_model, mdxnet_output_format, mdxnet_segment_size, mdxnet_overlap, mdxnet_denoise):
|
192 |
files_list = []
|
@@ -212,116 +112,6 @@ def mdxnet_separator(mdxnet_audio, mdxnet_model, mdxnet_output_format, mdxnet_se
|
|
212 |
|
213 |
return stem1_file, stem2_file
|
214 |
|
215 |
-
def vrarch_separator(vrarch_audio, vrarch_model, vrarch_output_format, vrarch_window_size, vrarch_agression, vrarch_tta, vrarch_high_end_process):
|
216 |
-
files_list = []
|
217 |
-
files_list.clear()
|
218 |
-
directory = "./outputs"
|
219 |
-
random_id = str(random.randint(10000, 99999))
|
220 |
-
pattern = f"{random_id}"
|
221 |
-
os.makedirs("outputs", exist_ok=True)
|
222 |
-
write(f'{random_id}.wav', vrarch_audio[0], vrarch_audio[1])
|
223 |
-
prompt = f"audio-separator {random_id}.wav --model_filename {vrarch_model} --output_dir=./outputs --output_format={vrarch_output_format} --normalization=0.9 --vr_window_size={vrarch_window_size} --vr_aggression={vrarch_agression}"
|
224 |
-
|
225 |
-
if vrarch_tta:
|
226 |
-
prompt += " --vr_enable_tta"
|
227 |
-
if vrarch_high_end_process:
|
228 |
-
prompt += " --vr_high_end_process"
|
229 |
-
|
230 |
-
os.system(prompt)
|
231 |
-
|
232 |
-
for file in os.listdir(directory):
|
233 |
-
if re.search(pattern, file):
|
234 |
-
files_list.append(os.path.join(directory, file))
|
235 |
-
|
236 |
-
stem1_file = files_list[0]
|
237 |
-
stem2_file = files_list[1]
|
238 |
-
|
239 |
-
return stem1_file, stem2_file
|
240 |
-
|
241 |
-
def demucs_separator(demucs_audio, demucs_model, demucs_output_format, demucs_shifts, demucs_overlap):
|
242 |
-
files_list = []
|
243 |
-
files_list.clear()
|
244 |
-
directory = "./outputs"
|
245 |
-
random_id = str(random.randint(10000, 99999))
|
246 |
-
pattern = f"{random_id}"
|
247 |
-
os.makedirs("outputs", exist_ok=True)
|
248 |
-
write(f'{random_id}.wav', demucs_audio[0], demucs_audio[1])
|
249 |
-
prompt = f"audio-separator {random_id}.wav --model_filename {demucs_model} --output_dir=./outputs --output_format={demucs_output_format} --normalization=0.9 --demucs_shifts={demucs_shifts} --demucs_overlap={demucs_overlap}"
|
250 |
-
|
251 |
-
os.system(prompt)
|
252 |
-
|
253 |
-
for file in os.listdir(directory):
|
254 |
-
if re.search(pattern, file):
|
255 |
-
files_list.append(os.path.join(directory, file))
|
256 |
-
|
257 |
-
stem1_file = files_list[0]
|
258 |
-
stem2_file = files_list[1]
|
259 |
-
stem3_file = files_list[2]
|
260 |
-
stem4_file = files_list[3]
|
261 |
-
|
262 |
-
return stem1_file, stem2_file, stem3_file, stem4_file
|
263 |
-
|
264 |
-
def roformer_batch(path_input, path_output, model, output_format, overlap, segment_size):
|
265 |
-
found_files = []
|
266 |
-
logs = []
|
267 |
-
logs.clear()
|
268 |
-
|
269 |
-
extensions = (".mp3", ".wav", ".flac")
|
270 |
-
|
271 |
-
full_roformer_model = roformer_models[model]
|
272 |
-
|
273 |
-
for audio_files in os.listdir(path_input):
|
274 |
-
if audio_files.endswith(extensions):
|
275 |
-
found_files.append(audio_files)
|
276 |
-
total_files = len(found_files)
|
277 |
-
|
278 |
-
if total_files == 0:
|
279 |
-
logs.append("No valid audio files.")
|
280 |
-
yield "\n".join(logs)
|
281 |
-
else:
|
282 |
-
logs.append(f"{total_files} audio files found")
|
283 |
-
found_files.sort()
|
284 |
-
|
285 |
-
for audio_files in found_files:
|
286 |
-
file_path = os.path.join(path_input, audio_files)
|
287 |
-
prompt = ["audio-separator", file_path, "-m", f"{full_roformer_model}", f"--output_dir={path_output}", f"--output_format={output_format}", "--normalization=0.9", f"--mdxc_overlap={overlap}", f"--mdxc_segment_size={segment_size}"]
|
288 |
-
logs.append(f"Processing file: {audio_files}")
|
289 |
-
yield "\n".join(logs)
|
290 |
-
subprocess.run(prompt)
|
291 |
-
logs.append(f"File: {audio_files} processed!")
|
292 |
-
yield "\n".join(logs)
|
293 |
-
|
294 |
-
def mdx23c_batch(path_input, path_output, model, output_format, overlap, segment_size, denoise):
|
295 |
-
found_files = []
|
296 |
-
logs = []
|
297 |
-
logs.clear()
|
298 |
-
|
299 |
-
extensions = (".mp3", ".wav", ".flac")
|
300 |
-
|
301 |
-
for audio_files in os.listdir(path_input):
|
302 |
-
if audio_files.endswith(extensions):
|
303 |
-
found_files.append(audio_files)
|
304 |
-
total_files = len(found_files)
|
305 |
-
|
306 |
-
if total_files == 0:
|
307 |
-
logs.append("No valid audio files.")
|
308 |
-
yield "\n".join(logs)
|
309 |
-
else:
|
310 |
-
logs.append(f"{total_files} audio files found")
|
311 |
-
found_files.sort()
|
312 |
-
|
313 |
-
for audio_files in found_files:
|
314 |
-
file_path = os.path.join(path_input, audio_files)
|
315 |
-
prompt = ["audio-separator", file_path, "-m", f"{model}", f"--output_dir={path_output}", f"--output_format={output_format}", "--normalization=0.9", f"--mdxc_overlap={overlap}", f"--mdxc_segment_size={segment_size}"]
|
316 |
-
|
317 |
-
if denoise:
|
318 |
-
prompt.append("--mdx_enable_denoise")
|
319 |
-
|
320 |
-
logs.append(f"Processing file: {audio_files}")
|
321 |
-
yield "\n".join(logs)
|
322 |
-
subprocess.run(prompt)
|
323 |
-
logs.append(f"File: {audio_files} processed!")
|
324 |
-
yield "\n".join(logs)
|
325 |
|
326 |
def mdxnet_batch(path_input, path_output, model, output_format, overlap, segment_size, denoise):
|
327 |
found_files = []
|
@@ -355,268 +145,12 @@ def mdxnet_batch(path_input, path_output, model, output_format, overlap, segment
|
|
355 |
logs.append(f"File: {audio_files} processed!")
|
356 |
yield "\n".join(logs)
|
357 |
|
358 |
-
def vrarch_batch(path_input, path_output, model, output_format, window_size, agression, tta, high_end_process):
|
359 |
-
found_files = []
|
360 |
-
logs = []
|
361 |
-
logs.clear()
|
362 |
-
|
363 |
-
extensions = (".mp3", ".wav", ".flac")
|
364 |
-
|
365 |
-
for audio_files in os.listdir(path_input):
|
366 |
-
if audio_files.endswith(extensions):
|
367 |
-
found_files.append(audio_files)
|
368 |
-
total_files = len(found_files)
|
369 |
-
|
370 |
-
if total_files == 0:
|
371 |
-
logs.append("No valid audio files.")
|
372 |
-
yield "\n".join(logs)
|
373 |
-
else:
|
374 |
-
logs.append(f"{total_files} audio files found")
|
375 |
-
found_files.sort()
|
376 |
-
|
377 |
-
for audio_files in found_files:
|
378 |
-
file_path = os.path.join(path_input, audio_files)
|
379 |
-
prompt = ["audio-separator", file_path, "-m", f"{model}", f"--output_dir={path_output}", f"--output_format={output_format}", "--normalization=0.9", f"--vr_window_size={window_size}", f"--vr_aggression={agression}"]
|
380 |
-
|
381 |
-
if tta:
|
382 |
-
prompt.append("--vr_enable_tta")
|
383 |
-
if high_end_process:
|
384 |
-
prompt.append("--vr_high_end_process")
|
385 |
-
|
386 |
-
logs.append(f"Processing file: {audio_files}")
|
387 |
-
yield "\n".join(logs)
|
388 |
-
subprocess.run(prompt)
|
389 |
-
logs.append(f"File: {audio_files} processed!")
|
390 |
-
yield "\n".join(logs)
|
391 |
-
|
392 |
-
def demucs_batch(path_input, path_output, model, output_format, shifts, overlap):
|
393 |
-
found_files = []
|
394 |
-
logs = []
|
395 |
-
logs.clear()
|
396 |
-
|
397 |
-
extensions = (".mp3", ".wav", ".flac")
|
398 |
|
399 |
-
|
400 |
-
|
401 |
-
found_files.append(audio_files)
|
402 |
-
total_files = len(found_files)
|
403 |
-
|
404 |
-
if total_files == 0:
|
405 |
-
logs.append("No valid audio files.")
|
406 |
-
yield "\n".join(logs)
|
407 |
-
else:
|
408 |
-
logs.append(f"{total_files} audio files found")
|
409 |
-
found_files.sort()
|
410 |
-
|
411 |
-
for audio_files in found_files:
|
412 |
-
file_path = os.path.join(path_input, audio_files)
|
413 |
-
prompt = ["audio-separator", file_path, "-m", f"{model}", f"--output_dir={path_output}", f"--output_format={output_format}", "--normalization=0.9", f"--demucs_shifts={shifts}", f"--demucs_overlap={overlap}"]
|
414 |
-
|
415 |
-
logs.append(f"Processing file: {audio_files}")
|
416 |
-
yield "\n".join(logs)
|
417 |
-
subprocess.run(prompt)
|
418 |
-
logs.append(f"File: {audio_files} processed!")
|
419 |
-
yield "\n".join(logs)
|
420 |
-
|
421 |
-
with gr.Blocks(theme="NoCrypt/miku@1.2.2", title="🎵 UVR5 UI 🎵") as app:
|
422 |
-
gr.Markdown("<h1> 🎵 UVR5 UI 🎵 </h1>")
|
423 |
gr.Markdown("If you liked this HF Space you can give me a ❤️")
|
424 |
gr.Markdown("Try UVR5 UI using Colab [here](https://colab.research.google.com/github/Eddycrack864/UVR5-UI/blob/main/UVR_UI.ipynb)")
|
425 |
-
with gr.Tabs():
|
426 |
-
with gr.TabItem("BS/Mel Roformer"):
|
427 |
-
with gr.Row():
|
428 |
-
roformer_model = gr.Dropdown(
|
429 |
-
label = "Select the Model",
|
430 |
-
choices=list(roformer_models.keys()),
|
431 |
-
interactive = True
|
432 |
-
)
|
433 |
-
roformer_output_format = gr.Dropdown(
|
434 |
-
label = "Select the Output Format",
|
435 |
-
choices = output_format,
|
436 |
-
interactive = True
|
437 |
-
)
|
438 |
-
with gr.Row():
|
439 |
-
roformer_overlap = gr.Slider(
|
440 |
-
minimum = 2,
|
441 |
-
maximum = 4,
|
442 |
-
step = 1,
|
443 |
-
label = "Overlap",
|
444 |
-
info = "Amount of overlap between prediction windows.",
|
445 |
-
value = 4,
|
446 |
-
interactive = True
|
447 |
-
)
|
448 |
-
roformer_segment_size = gr.Slider(
|
449 |
-
minimum = 32,
|
450 |
-
maximum = 4000,
|
451 |
-
step = 32,
|
452 |
-
label = "Segment Size",
|
453 |
-
info = "Larger consumes more resources, but may give better results.",
|
454 |
-
value = 256,
|
455 |
-
interactive = True
|
456 |
-
)
|
457 |
-
with gr.Row():
|
458 |
-
roformer_audio = gr.Audio(
|
459 |
-
label = "Input Audio",
|
460 |
-
type = "numpy",
|
461 |
-
interactive = True
|
462 |
-
)
|
463 |
-
with gr.Accordion("Separation by Link", open = False):
|
464 |
-
with gr.Row():
|
465 |
-
roformer_link = gr.Textbox(
|
466 |
-
label = "Link",
|
467 |
-
placeholder = "Paste the link here",
|
468 |
-
interactive = True
|
469 |
-
)
|
470 |
-
with gr.Row():
|
471 |
-
gr.Markdown("You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)")
|
472 |
-
with gr.Row():
|
473 |
-
roformer_download_button = gr.Button(
|
474 |
-
"Download!",
|
475 |
-
variant = "primary"
|
476 |
-
)
|
477 |
-
|
478 |
-
roformer_download_button.click(download_audio, [roformer_link], [roformer_audio])
|
479 |
-
|
480 |
-
with gr.Accordion("Batch Separation", open = False):
|
481 |
-
with gr.Row():
|
482 |
-
roformer_input_path = gr.Textbox(
|
483 |
-
label = "Input Path",
|
484 |
-
placeholder = "Place the input path here",
|
485 |
-
interactive = True
|
486 |
-
)
|
487 |
-
roformer_output_path = gr.Textbox(
|
488 |
-
label = "Output Path",
|
489 |
-
placeholder = "Place the output path here",
|
490 |
-
interactive = True
|
491 |
-
)
|
492 |
-
with gr.Row():
|
493 |
-
roformer_bath_button = gr.Button("Separate!", variant = "primary")
|
494 |
-
with gr.Row():
|
495 |
-
roformer_info = gr.Textbox(
|
496 |
-
label = "Output Information",
|
497 |
-
interactive = False
|
498 |
-
)
|
499 |
-
|
500 |
-
roformer_bath_button.click(roformer_batch, [roformer_input_path, roformer_output_path, roformer_model, roformer_output_format, roformer_overlap, roformer_segment_size], [roformer_info])
|
501 |
-
|
502 |
-
with gr.Row():
|
503 |
-
roformer_button = gr.Button("Separate!", variant = "primary")
|
504 |
-
with gr.Row():
|
505 |
-
roformer_stem1 = gr.Audio(
|
506 |
-
show_download_button = True,
|
507 |
-
interactive = False,
|
508 |
-
label = "Stem 1",
|
509 |
-
type = "filepath"
|
510 |
-
)
|
511 |
-
roformer_stem2 = gr.Audio(
|
512 |
-
show_download_button = True,
|
513 |
-
interactive = False,
|
514 |
-
label = "Stem 2",
|
515 |
-
type = "filepath"
|
516 |
-
)
|
517 |
-
|
518 |
-
roformer_button.click(roformer_separator, [roformer_audio, roformer_model, roformer_output_format, roformer_overlap, roformer_segment_size], [roformer_stem1, roformer_stem2])
|
519 |
-
|
520 |
-
with gr.TabItem("MDX23C"):
|
521 |
-
with gr.Row():
|
522 |
-
mdx23c_model = gr.Dropdown(
|
523 |
-
label = "Select the Model",
|
524 |
-
choices = mdx23c_models,
|
525 |
-
interactive = True
|
526 |
-
)
|
527 |
-
mdx23c_output_format = gr.Dropdown(
|
528 |
-
label = "Select the Output Format",
|
529 |
-
choices = output_format,
|
530 |
-
interactive = True
|
531 |
-
)
|
532 |
-
with gr.Row():
|
533 |
-
mdx23c_segment_size = gr.Slider(
|
534 |
-
minimum = 32,
|
535 |
-
maximum = 4000,
|
536 |
-
step = 32,
|
537 |
-
label = "Segment Size",
|
538 |
-
info = "Larger consumes more resources, but may give better results.",
|
539 |
-
value = 256,
|
540 |
-
interactive = True
|
541 |
-
)
|
542 |
-
mdx23c_overlap = gr.Slider(
|
543 |
-
minimum = 2,
|
544 |
-
maximum = 50,
|
545 |
-
step = 1,
|
546 |
-
label = "Overlap",
|
547 |
-
info = "Amount of overlap between prediction windows.",
|
548 |
-
value = 8,
|
549 |
-
interactive = True
|
550 |
-
)
|
551 |
-
mdx23c_denoise = gr.Checkbox(
|
552 |
-
label = "Denoise",
|
553 |
-
info = "Enable denoising during separation.",
|
554 |
-
value = False,
|
555 |
-
interactive = True
|
556 |
-
)
|
557 |
-
with gr.Row():
|
558 |
-
mdx23c_audio = gr.Audio(
|
559 |
-
label = "Input Audio",
|
560 |
-
type = "numpy",
|
561 |
-
interactive = True
|
562 |
-
)
|
563 |
-
with gr.Accordion("Separation by Link", open = False):
|
564 |
-
with gr.Row():
|
565 |
-
mdx23c_link = gr.Textbox(
|
566 |
-
label = "Link",
|
567 |
-
placeholder = "Paste the link here",
|
568 |
-
interactive = True
|
569 |
-
)
|
570 |
-
with gr.Row():
|
571 |
-
gr.Markdown("You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)")
|
572 |
-
with gr.Row():
|
573 |
-
mdx23c_download_button = gr.Button(
|
574 |
-
"Download!",
|
575 |
-
variant = "primary"
|
576 |
-
)
|
577 |
-
|
578 |
-
mdx23c_download_button.click(download_audio, [mdx23c_link], [mdx23c_audio])
|
579 |
-
|
580 |
-
with gr.Accordion("Batch Separation", open = False):
|
581 |
-
with gr.Row():
|
582 |
-
mdx23c_input_path = gr.Textbox(
|
583 |
-
label = "Input Path",
|
584 |
-
placeholder = "Place the input path here",
|
585 |
-
interactive = True
|
586 |
-
)
|
587 |
-
mdx23c_output_path = gr.Textbox(
|
588 |
-
label = "Output Path",
|
589 |
-
placeholder = "Place the output path here",
|
590 |
-
interactive = True
|
591 |
-
)
|
592 |
-
with gr.Row():
|
593 |
-
mdx23c_bath_button = gr.Button("Separate!", variant = "primary")
|
594 |
-
with gr.Row():
|
595 |
-
mdx23c_info = gr.Textbox(
|
596 |
-
label = "Output Information",
|
597 |
-
interactive = False
|
598 |
-
)
|
599 |
-
|
600 |
-
mdx23c_bath_button.click(mdx23c_batch, [mdx23c_input_path, mdx23c_output_path, mdx23c_model, mdx23c_output_format, mdx23c_overlap, mdx23c_segment_size, mdx23c_denoise], [mdx23c_info])
|
601 |
-
|
602 |
-
with gr.Row():
|
603 |
-
mdx23c_button = gr.Button("Separate!", variant = "primary")
|
604 |
-
with gr.Row():
|
605 |
-
mdx23c_stem1 = gr.Audio(
|
606 |
-
show_download_button = True,
|
607 |
-
interactive = False,
|
608 |
-
label = "Stem 1",
|
609 |
-
type = "filepath"
|
610 |
-
)
|
611 |
-
mdx23c_stem2 = gr.Audio(
|
612 |
-
show_download_button = True,
|
613 |
-
interactive = False,
|
614 |
-
label = "Stem 2",
|
615 |
-
type = "filepath"
|
616 |
-
)
|
617 |
-
|
618 |
-
mdx23c_button.click(mdxc_separator, [mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segment_size, mdx23c_overlap, mdx23c_denoise], [mdx23c_stem1, mdx23c_stem2])
|
619 |
-
|
620 |
with gr.TabItem("MDX-NET"):
|
621 |
with gr.Row():
|
622 |
mdxnet_model = gr.Dropdown(
|
@@ -714,214 +248,7 @@ with gr.Blocks(theme="NoCrypt/miku@1.2.2", title="🎵 UVR5 UI 🎵") as app:
|
|
714 |
|
715 |
mdxnet_button.click(mdxnet_separator, [mdxnet_audio, mdxnet_model, mdxnet_output_format, mdxnet_segment_size, mdxnet_overlap, mdxnet_denoise], [mdxnet_stem1, mdxnet_stem2])
|
716 |
|
717 |
-
|
718 |
-
with gr.Row():
|
719 |
-
vrarch_model = gr.Dropdown(
|
720 |
-
label = "Select the Model",
|
721 |
-
choices = vrarch_models,
|
722 |
-
interactive = True
|
723 |
-
)
|
724 |
-
vrarch_output_format = gr.Dropdown(
|
725 |
-
label = "Select the Output Format",
|
726 |
-
choices = output_format,
|
727 |
-
interactive = True
|
728 |
-
)
|
729 |
-
with gr.Row():
|
730 |
-
vrarch_window_size = gr.Dropdown(
|
731 |
-
label = "Window Size",
|
732 |
-
choices = vrarch_window_size_values,
|
733 |
-
value = vrarch_window_size_values[0],
|
734 |
-
interactive = True
|
735 |
-
)
|
736 |
-
vrarch_agression = gr.Slider(
|
737 |
-
minimum = 1,
|
738 |
-
maximum = 50,
|
739 |
-
step = 1,
|
740 |
-
label = "Agression",
|
741 |
-
info = "Intensity of primary stem extraction.",
|
742 |
-
value = 5,
|
743 |
-
interactive = True
|
744 |
-
)
|
745 |
-
vrarch_tta = gr.Checkbox(
|
746 |
-
label = "TTA",
|
747 |
-
info = "Enable Test-Time-Augmentation; slow but improves quality.",
|
748 |
-
value = True,
|
749 |
-
visible = True,
|
750 |
-
interactive = True,
|
751 |
-
)
|
752 |
-
vrarch_high_end_process = gr.Checkbox(
|
753 |
-
label = "High End Process",
|
754 |
-
info = "Mirror the missing frequency range of the output.",
|
755 |
-
value = False,
|
756 |
-
visible = True,
|
757 |
-
interactive = True,
|
758 |
-
)
|
759 |
-
with gr.Row():
|
760 |
-
vrarch_audio = gr.Audio(
|
761 |
-
label = "Input Audio",
|
762 |
-
type = "numpy",
|
763 |
-
interactive = True
|
764 |
-
)
|
765 |
-
with gr.Accordion("Separation by Link", open = False):
|
766 |
-
with gr.Row():
|
767 |
-
vrarch_link = gr.Textbox(
|
768 |
-
label = "Link",
|
769 |
-
placeholder = "Paste the link here",
|
770 |
-
interactive = True
|
771 |
-
)
|
772 |
-
with gr.Row():
|
773 |
-
gr.Markdown("You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)")
|
774 |
-
with gr.Row():
|
775 |
-
vrarch_download_button = gr.Button(
|
776 |
-
"Download!",
|
777 |
-
variant = "primary"
|
778 |
-
)
|
779 |
-
|
780 |
-
vrarch_download_button.click(download_audio, [vrarch_link], [vrarch_audio])
|
781 |
-
|
782 |
-
with gr.Accordion("Batch Separation", open = False):
|
783 |
-
with gr.Row():
|
784 |
-
vrarch_input_path = gr.Textbox(
|
785 |
-
label = "Input Path",
|
786 |
-
placeholder = "Place the input path here",
|
787 |
-
interactive = True
|
788 |
-
)
|
789 |
-
vrarch_output_path = gr.Textbox(
|
790 |
-
label = "Output Path",
|
791 |
-
placeholder = "Place the output path here",
|
792 |
-
interactive = True
|
793 |
-
)
|
794 |
-
with gr.Row():
|
795 |
-
vrarch_bath_button = gr.Button("Separate!", variant = "primary")
|
796 |
-
with gr.Row():
|
797 |
-
vrarch_info = gr.Textbox(
|
798 |
-
label = "Output Information",
|
799 |
-
interactive = False
|
800 |
-
)
|
801 |
-
|
802 |
-
vrarch_bath_button.click(vrarch_batch, [vrarch_input_path, vrarch_output_path, vrarch_model, vrarch_output_format, vrarch_window_size, vrarch_agression, vrarch_tta, vrarch_high_end_process], [vrarch_info])
|
803 |
-
|
804 |
-
with gr.Row():
|
805 |
-
vrarch_button = gr.Button("Separate!", variant = "primary")
|
806 |
-
with gr.Row():
|
807 |
-
vrarch_stem1 = gr.Audio(
|
808 |
-
show_download_button = True,
|
809 |
-
interactive = False,
|
810 |
-
type = "filepath",
|
811 |
-
label = "Stem 1"
|
812 |
-
)
|
813 |
-
vrarch_stem2 = gr.Audio(
|
814 |
-
show_download_button = True,
|
815 |
-
interactive = False,
|
816 |
-
type = "filepath",
|
817 |
-
label = "Stem 2"
|
818 |
-
)
|
819 |
-
|
820 |
-
vrarch_button.click(vrarch_separator, [vrarch_audio, vrarch_model, vrarch_output_format, vrarch_window_size, vrarch_agression, vrarch_tta, vrarch_high_end_process], [vrarch_stem1, vrarch_stem2])
|
821 |
-
|
822 |
-
with gr.TabItem("Demucs"):
|
823 |
-
with gr.Row():
|
824 |
-
demucs_model = gr.Dropdown(
|
825 |
-
label = "Select the Model",
|
826 |
-
choices = demucs_models,
|
827 |
-
interactive = True
|
828 |
-
)
|
829 |
-
demucs_output_format = gr.Dropdown(
|
830 |
-
label = "Select the Output Format",
|
831 |
-
choices = output_format,
|
832 |
-
interactive = True
|
833 |
-
)
|
834 |
-
with gr.Row():
|
835 |
-
demucs_shifts = gr.Slider(
|
836 |
-
minimum = 1,
|
837 |
-
maximum = 20,
|
838 |
-
step = 1,
|
839 |
-
label = "Shifts",
|
840 |
-
info = "Number of predictions with random shifts, higher = slower but better quality.",
|
841 |
-
value = 2,
|
842 |
-
interactive = True
|
843 |
-
)
|
844 |
-
demucs_overlap = gr.Dropdown(
|
845 |
-
label = "Overlap",
|
846 |
-
choices = demucs_overlap_values,
|
847 |
-
value = demucs_overlap_values[0],
|
848 |
-
interactive = True
|
849 |
-
)
|
850 |
-
with gr.Row():
|
851 |
-
demucs_audio = gr.Audio(
|
852 |
-
label = "Input Audio",
|
853 |
-
type = "numpy",
|
854 |
-
interactive = True
|
855 |
-
)
|
856 |
-
with gr.Accordion("Separation by Link", open = False):
|
857 |
-
with gr.Row():
|
858 |
-
demucs_link = gr.Textbox(
|
859 |
-
label = "Link",
|
860 |
-
placeholder = "Paste the link here",
|
861 |
-
interactive = True
|
862 |
-
)
|
863 |
-
with gr.Row():
|
864 |
-
gr.Markdown("You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)")
|
865 |
-
with gr.Row():
|
866 |
-
demucs_download_button = gr.Button(
|
867 |
-
"Download!",
|
868 |
-
variant = "primary"
|
869 |
-
)
|
870 |
-
|
871 |
-
demucs_download_button.click(download_audio, [demucs_link], [demucs_audio])
|
872 |
-
|
873 |
-
with gr.Accordion("Batch Separation", open = False):
|
874 |
-
with gr.Row():
|
875 |
-
demucs_input_path = gr.Textbox(
|
876 |
-
label = "Input Path",
|
877 |
-
placeholder = "Place the input path here",
|
878 |
-
interactive = True
|
879 |
-
)
|
880 |
-
demucs_output_path = gr.Textbox(
|
881 |
-
label = "Output Path",
|
882 |
-
placeholder = "Place the output path here",
|
883 |
-
interactive = True
|
884 |
-
)
|
885 |
-
with gr.Row():
|
886 |
-
demucs_bath_button = gr.Button("Separate!", variant = "primary")
|
887 |
-
with gr.Row():
|
888 |
-
demucs_info = gr.Textbox(
|
889 |
-
label = "Output Information",
|
890 |
-
interactive = False
|
891 |
-
)
|
892 |
-
|
893 |
-
demucs_bath_button.click(demucs_batch, [demucs_input_path, demucs_output_path, demucs_model, demucs_output_format, demucs_shifts, demucs_overlap], [demucs_info])
|
894 |
-
|
895 |
-
with gr.Row():
|
896 |
-
demucs_button = gr.Button("Separate!", variant = "primary")
|
897 |
-
with gr.Row():
|
898 |
-
demucs_stem1 = gr.Audio(
|
899 |
-
show_download_button = True,
|
900 |
-
interactive = False,
|
901 |
-
type = "filepath",
|
902 |
-
label = "Stem 1"
|
903 |
-
)
|
904 |
-
demucs_stem2 = gr.Audio(
|
905 |
-
show_download_button = True,
|
906 |
-
interactive = False,
|
907 |
-
type = "filepath",
|
908 |
-
label = "Stem 2"
|
909 |
-
)
|
910 |
-
with gr.Row():
|
911 |
-
demucs_stem3 = gr.Audio(
|
912 |
-
show_download_button = True,
|
913 |
-
interactive = False,
|
914 |
-
type = "filepath",
|
915 |
-
label = "Stem 3"
|
916 |
-
)
|
917 |
-
demucs_stem4 = gr.Audio(
|
918 |
-
show_download_button = True,
|
919 |
-
interactive = False,
|
920 |
-
type = "filepath",
|
921 |
-
label = "Stem 4"
|
922 |
-
)
|
923 |
-
|
924 |
-
demucs_button.click(demucs_separator, [demucs_audio, demucs_model, demucs_output_format, demucs_shifts, demucs_overlap], [demucs_stem1, demucs_stem2, demucs_stem3, demucs_stem4])
|
925 |
|
926 |
with gr.TabItem("Credits"):
|
927 |
gr.Markdown(
|
|
|
8 |
import yt_dlp
|
9 |
import subprocess
|
10 |
|
11 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
mdxnet_models = [
|
14 |
'UVR-MDX-NET-Inst_full_292.onnx',
|
|
|
51 |
'kuielab_b_drums.onnx',
|
52 |
]
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
output_format = [
|
57 |
'wav',
|
|
|
66 |
'0.99',
|
67 |
]
|
68 |
|
|
|
|
|
|
|
|
|
|
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
def download_audio(url):
|
72 |
ydl_opts = {
|
|
|
87 |
|
88 |
return sample_rate, audio_array
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
def mdxnet_separator(mdxnet_audio, mdxnet_model, mdxnet_output_format, mdxnet_segment_size, mdxnet_overlap, mdxnet_denoise):
|
92 |
files_list = []
|
|
|
112 |
|
113 |
return stem1_file, stem2_file
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
def mdxnet_batch(path_input, path_output, model, output_format, overlap, segment_size, denoise):
|
117 |
found_files = []
|
|
|
145 |
logs.append(f"File: {audio_files} processed!")
|
146 |
yield "\n".join(logs)
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
+
with gr.Blocks(theme="Blane187/fuchsia", title="🎵 UVR5 MDX 🎵") as app:
|
150 |
+
gr.Markdown("<h1> 🎵 UVR MDX 🎵 </h1>")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
gr.Markdown("If you liked this HF Space you can give me a ❤️")
|
152 |
gr.Markdown("Try UVR5 UI using Colab [here](https://colab.research.google.com/github/Eddycrack864/UVR5-UI/blob/main/UVR_UI.ipynb)")
|
153 |
+
with gr.Tabs():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
with gr.TabItem("MDX-NET"):
|
155 |
with gr.Row():
|
156 |
mdxnet_model = gr.Dropdown(
|
|
|
248 |
|
249 |
mdxnet_button.click(mdxnet_separator, [mdxnet_audio, mdxnet_model, mdxnet_output_format, mdxnet_segment_size, mdxnet_overlap, mdxnet_denoise], [mdxnet_stem1, mdxnet_stem2])
|
250 |
|
251 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
|
253 |
with gr.TabItem("Credits"):
|
254 |
gr.Markdown(
|