Eddycrack864 commited on
Commit
81d696f
·
verified ·
1 Parent(s): 95a2442

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +674 -567
app.py CHANGED
@@ -1,568 +1,675 @@
1
- import os
2
- import re
3
- import random
4
- from scipy.io.wavfile import write
5
- import gradio as gr
6
-
7
- roformer_models = {
8
- 'BS-Roformer-Viperx-1297.ckpt': 'model_bs_roformer_ep_317_sdr_12.9755.ckpt',
9
- 'BS-Roformer-Viperx-1296.ckpt': 'model_bs_roformer_ep_368_sdr_12.9628.ckpt',
10
- 'BS-Roformer-Viperx-1053.ckpt': 'model_bs_roformer_ep_937_sdr_10.5309.ckpt',
11
- 'Mel-Roformer-Viperx-1143.ckpt': 'model_mel_band_roformer_ep_3005_sdr_11.4360.ckpt'
12
- }
13
-
14
- mdx23c_models = [
15
- 'MDX23C_D1581.ckpt',
16
- 'MDX23C-8KFFT-InstVoc_HQ.ckpt',
17
- 'MDX23C-8KFFT-InstVoc_HQ_2.ckpt',
18
- ]
19
-
20
- mdxnet_models = [
21
- 'UVR-MDX-NET-Inst_full_292.onnx',
22
- 'UVR-MDX-NET_Inst_187_beta.onnx',
23
- 'UVR-MDX-NET_Inst_82_beta.onnx',
24
- 'UVR-MDX-NET_Inst_90_beta.onnx',
25
- 'UVR-MDX-NET_Main_340.onnx',
26
- 'UVR-MDX-NET_Main_390.onnx',
27
- 'UVR-MDX-NET_Main_406.onnx',
28
- 'UVR-MDX-NET_Main_427.onnx',
29
- 'UVR-MDX-NET_Main_438.onnx',
30
- 'UVR-MDX-NET-Inst_HQ_1.onnx',
31
- 'UVR-MDX-NET-Inst_HQ_2.onnx',
32
- 'UVR-MDX-NET-Inst_HQ_3.onnx',
33
- 'UVR-MDX-NET-Inst_HQ_4.onnx',
34
- 'UVR_MDXNET_Main.onnx',
35
- 'UVR-MDX-NET-Inst_Main.onnx',
36
- 'UVR_MDXNET_1_9703.onnx',
37
- 'UVR_MDXNET_2_9682.onnx',
38
- 'UVR_MDXNET_3_9662.onnx',
39
- 'UVR-MDX-NET-Inst_1.onnx',
40
- 'UVR-MDX-NET-Inst_2.onnx',
41
- 'UVR-MDX-NET-Inst_3.onnx',
42
- 'UVR_MDXNET_KARA.onnx',
43
- 'UVR_MDXNET_KARA_2.onnx',
44
- 'UVR_MDXNET_9482.onnx',
45
- 'UVR-MDX-NET-Voc_FT.onnx',
46
- 'Kim_Vocal_1.onnx',
47
- 'Kim_Vocal_2.onnx',
48
- 'Kim_Inst.onnx',
49
- 'Reverb_HQ_By_FoxJoy.onnx',
50
- 'UVR-MDX-NET_Crowd_HQ_1.onnx',
51
- 'kuielab_a_vocals.onnx',
52
- 'kuielab_a_other.onnx',
53
- 'kuielab_a_bass.onnx',
54
- 'kuielab_a_drums.onnx',
55
- 'kuielab_b_vocals.onnx',
56
- 'kuielab_b_other.onnx',
57
- 'kuielab_b_bass.onnx',
58
- 'kuielab_b_drums.onnx',
59
- ]
60
-
61
- vrarch_models = [
62
- '1_HP-UVR.pth',
63
- '2_HP-UVR.pth',
64
- '3_HP-Vocal-UVR.pth',
65
- '4_HP-Vocal-UVR.pth',
66
- '5_HP-Karaoke-UVR.pth',
67
- '6_HP-Karaoke-UVR.pth',
68
- '7_HP2-UVR.pth',
69
- '8_HP2-UVR.pth',
70
- '9_HP2-UVR.pth',
71
- '10_SP-UVR-2B-32000-1.pth',
72
- '11_SP-UVR-2B-32000-2.pth',
73
- '12_SP-UVR-3B-44100.pth',
74
- '13_SP-UVR-4B-44100-1.pth',
75
- '14_SP-UVR-4B-44100-2.pth',
76
- '15_SP-UVR-MID-44100-1.pth',
77
- '16_SP-UVR-MID-44100-2.pth',
78
- '17_HP-Wind_Inst-UVR.pth',
79
- 'UVR-De-Echo-Aggressive.pth',
80
- 'UVR-De-Echo-Normal.pth',
81
- 'UVR-DeEcho-DeReverb.pth',
82
- 'UVR-DeNoise-Lite.pth',
83
- 'UVR-DeNoise.pth',
84
- 'UVR-BVE-4B_SN-44100-1.pth',
85
- 'MGM_HIGHEND_v4.pth',
86
- 'MGM_LOWEND_A_v4.pth',
87
- 'MGM_LOWEND_B_v4.pth',
88
- 'MGM_MAIN_v4.pth',
89
- ]
90
-
91
- demucs_models = [
92
- 'htdemucs_ft.yaml',
93
- 'htdemucs.yaml',
94
- 'hdemucs_mmi.yaml',
95
- ]
96
-
97
- output_format = [
98
- 'wav',
99
- 'flac',
100
- 'mp3',
101
- ]
102
-
103
- mdxnet_overlap_values = [
104
- '0.25',
105
- '0.5',
106
- '0.75',
107
- '0.99',
108
- ]
109
-
110
- vrarch_window_size_values = [
111
- '320',
112
- '512',
113
- '1024',
114
- ]
115
-
116
- demucs_overlap_values = [
117
- '0.25',
118
- '0.50',
119
- '0.75',
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"
127
- random_id = str(random.randint(10000, 99999))
128
- pattern = f"{random_id}"
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):
136
- if re.search(pattern, file):
137
- files_list.append(os.path.join(directory, file))
138
-
139
- stem1_file = files_list[0]
140
- stem2_file = files_list[1]
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"
148
- random_id = str(random.randint(10000, 99999))
149
- pattern = f"{random_id}"
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):
160
- if re.search(pattern, file):
161
- files_list.append(os.path.join(directory, file))
162
-
163
- stem1_file = files_list[0]
164
- stem2_file = files_list[1]
165
-
166
- return stem1_file, stem2_file
167
-
168
- def mdxnet_separator(mdxnet_audio, mdxnet_model, mdxnet_output_format, mdxnet_segment_size, mdxnet_overlap, mdxnet_denoise):
169
- files_list = []
170
- files_list.clear()
171
- directory = "./outputs"
172
- random_id = str(random.randint(10000, 99999))
173
- pattern = f"{random_id}"
174
- os.makedirs("outputs", exist_ok=True)
175
- write(f'{random_id}.wav', mdxnet_audio[0], mdxnet_audio[1])
176
- prompt = f"audio-separator {random_id}.wav --model_filename {mdxnet_model} --output_dir=./outputs --output_format={mdxnet_output_format} --normalization=0.9 --mdx_segment_size={mdxnet_segment_size} --mdx_overlap={mdxnet_overlap}"
177
-
178
- if mdxnet_denoise:
179
- prompt += " --mdx_enable_denoise"
180
-
181
- os.system(prompt)
182
-
183
- for file in os.listdir(directory):
184
- if re.search(pattern, file):
185
- files_list.append(os.path.join(directory, file))
186
-
187
- stem1_file = files_list[0]
188
- stem2_file = files_list[1]
189
-
190
- return stem1_file, stem2_file
191
-
192
- def vrarch_separator(vrarch_audio, vrarch_model, vrarch_output_format, vrarch_window_size, vrarch_agression, vrarch_tta, vrarch_high_end_process):
193
- files_list = []
194
- files_list.clear()
195
- directory = "./outputs"
196
- random_id = str(random.randint(10000, 99999))
197
- pattern = f"{random_id}"
198
- os.makedirs("outputs", exist_ok=True)
199
- write(f'{random_id}.wav', vrarch_audio[0], vrarch_audio[1])
200
- 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}"
201
-
202
- if vrarch_tta:
203
- prompt += " --vr_enable_tta"
204
- if vrarch_high_end_process:
205
- prompt += " --vr_high_end_process"
206
-
207
- os.system(prompt)
208
-
209
- for file in os.listdir(directory):
210
- if re.search(pattern, file):
211
- files_list.append(os.path.join(directory, file))
212
-
213
- stem1_file = files_list[0]
214
- stem2_file = files_list[1]
215
-
216
- return stem1_file, stem2_file
217
-
218
- def demucs_separator(demucs_audio, demucs_model, demucs_output_format, demucs_shifts, demucs_overlap):
219
- files_list = []
220
- files_list.clear()
221
- directory = "./outputs"
222
- random_id = str(random.randint(10000, 99999))
223
- pattern = f"{random_id}"
224
- os.makedirs("outputs", exist_ok=True)
225
- write(f'{random_id}.wav', demucs_audio[0], demucs_audio[1])
226
- 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}"
227
-
228
- os.system(prompt)
229
-
230
- for file in os.listdir(directory):
231
- if re.search(pattern, file):
232
- files_list.append(os.path.join(directory, file))
233
-
234
- stem1_file = files_list[0]
235
- stem2_file = files_list[1]
236
- stem3_file = files_list[2]
237
- stem4_file = files_list[3]
238
-
239
- return stem1_file, stem2_file, stem3_file, stem4_file
240
-
241
- with gr.Blocks(theme="NoCrypt/[email protected]", title="🎵 UVR5 UI 🎵") as app:
242
- gr.Markdown("<h1> 🎵 UVR5 UI 🎵 </h1>")
243
- gr.Markdown("If you liked this HF Space you can give me a ❤️")
244
- gr.Markdown("Try UVR5 UI using Colab [here](https://colab.research.google.com/github/Eddycrack864/UVR5-UI/blob/main/UVR_UI.ipynb)")
245
- with gr.Tabs():
246
- with gr.TabItem("BS/Mel Roformer"):
247
- with gr.Row():
248
- roformer_model = gr.Dropdown(
249
- label = "Select the Model",
250
- choices=list(roformer_models.keys()),
251
- interactive = True
252
- )
253
- roformer_output_format = gr.Dropdown(
254
- label = "Select the Output Format",
255
- choices = output_format,
256
- interactive = True
257
- )
258
- with gr.Row():
259
- roformer_overlap = gr.Slider(
260
- minimum = 2,
261
- maximum = 4,
262
- step = 1,
263
- label = "Overlap",
264
- info = "Amount of overlap between prediction windows.",
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",
280
- type = "numpy",
281
- interactive = True
282
- )
283
- with gr.Row():
284
- roformer_button = gr.Button("Separate!", variant = "primary")
285
- with gr.Row():
286
- roformer_stem1 = gr.Audio(
287
- show_download_button = True,
288
- interactive = False,
289
- label = "Stem 1",
290
- type = "filepath"
291
- )
292
- roformer_stem2 = gr.Audio(
293
- show_download_button = True,
294
- interactive = False,
295
- label = "Stem 2",
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():
303
- mdx23c_model = gr.Dropdown(
304
- label = "Select the Model",
305
- choices = mdx23c_models,
306
- interactive = True
307
- )
308
- mdx23c_output_format = gr.Dropdown(
309
- label = "Select the Output Format",
310
- choices = output_format,
311
- interactive = True
312
- )
313
- with gr.Row():
314
- mdx23c_segment_size = gr.Slider(
315
- minimum = 32,
316
- maximum = 4000,
317
- step = 32,
318
- label = "Segment Size",
319
- info = "Larger consumes more resources, but may give better results.",
320
- value = 256,
321
- interactive = True
322
- )
323
- mdx23c_overlap = gr.Slider(
324
- minimum = 2,
325
- maximum = 50,
326
- step = 1,
327
- label = "Overlap",
328
- info = "Amount of overlap between prediction windows.",
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",
341
- type = "numpy",
342
- interactive = True
343
- )
344
- with gr.Row():
345
- mdx23c_button = gr.Button("Separate!", variant = "primary")
346
- with gr.Row():
347
- mdx23c_stem1 = gr.Audio(
348
- show_download_button = True,
349
- interactive = False,
350
- label = "Stem 1",
351
- type = "filepath"
352
- )
353
- mdx23c_stem2 = gr.Audio(
354
- show_download_button = True,
355
- interactive = False,
356
- label = "Stem 2",
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():
364
- mdxnet_model = gr.Dropdown(
365
- label = "Select the Model",
366
- choices = mdxnet_models,
367
- interactive = True
368
- )
369
- mdxnet_output_format = gr.Dropdown(
370
- label = "Select the Output Format",
371
- choices = output_format,
372
- interactive = True
373
- )
374
- with gr.Row():
375
- mdxnet_segment_size = gr.Slider(
376
- minimum = 32,
377
- maximum = 4000,
378
- step = 32,
379
- label = "Segment Size",
380
- info = "Larger consumes more resources, but may give better results.",
381
- value = 256,
382
- interactive = True
383
- )
384
- mdxnet_overlap = gr.Dropdown(
385
- label = "Overlap",
386
- choices = mdxnet_overlap_values,
387
- value = mdxnet_overlap_values[0],
388
- interactive = True
389
- )
390
- mdxnet_denoise = gr.Checkbox(
391
- label = "Denoise",
392
- info = "Enable denoising during separation.",
393
- value = True,
394
- interactive = True
395
- )
396
- with gr.Row():
397
- mdxnet_audio = gr.Audio(
398
- label = "Input Audio",
399
- type = "numpy",
400
- interactive = True
401
- )
402
- with gr.Row():
403
- mdxnet_button = gr.Button("Separate!", variant = "primary")
404
- with gr.Row():
405
- mdxnet_stem1 = gr.Audio(
406
- show_download_button = True,
407
- interactive = False,
408
- label = "Stem 1",
409
- type = "filepath"
410
- )
411
- mdxnet_stem2 = gr.Audio(
412
- show_download_button = True,
413
- interactive = False,
414
- label = "Stem 2",
415
- type = "filepath"
416
- )
417
-
418
- mdxnet_button.click(mdxnet_separator, [mdxnet_audio, mdxnet_model, mdxnet_output_format, mdxnet_segment_size, mdxnet_overlap, mdxnet_denoise], [mdxnet_stem1, mdxnet_stem2])
419
-
420
- with gr.TabItem("VR ARCH"):
421
- with gr.Row():
422
- vrarch_model = gr.Dropdown(
423
- label = "Select the Model",
424
- choices = vrarch_models,
425
- interactive = True
426
- )
427
- vrarch_output_format = gr.Dropdown(
428
- label = "Select the Output Format",
429
- choices = output_format,
430
- interactive = True
431
- )
432
- with gr.Row():
433
- vrarch_window_size = gr.Dropdown(
434
- label = "Window Size",
435
- choices = vrarch_window_size_values,
436
- value = vrarch_window_size_values[0],
437
- interactive = True
438
- )
439
- vrarch_agression = gr.Slider(
440
- minimum = 1,
441
- maximum = 50,
442
- step = 1,
443
- label = "Agression",
444
- info = "Intensity of primary stem extraction.",
445
- value = 5,
446
- interactive = True
447
- )
448
- vrarch_tta = gr.Checkbox(
449
- label = "TTA",
450
- info = "Enable Test-Time-Augmentation; slow but improves quality.",
451
- value = True,
452
- visible = True,
453
- interactive = True,
454
- )
455
- vrarch_high_end_process = gr.Checkbox(
456
- label = "High End Process",
457
- info = "Mirror the missing frequency range of the output.",
458
- value = False,
459
- visible = True,
460
- interactive = True,
461
- )
462
- with gr.Row():
463
- vrarch_audio = gr.Audio(
464
- label = "Input Audio",
465
- type = "numpy",
466
- interactive = True
467
- )
468
- with gr.Row():
469
- vrarch_button = gr.Button("Separate!", variant = "primary")
470
- with gr.Row():
471
- vrarch_stem1 = gr.Audio(
472
- show_download_button = True,
473
- interactive = False,
474
- type = "filepath",
475
- label = "Stem 1"
476
- )
477
- vrarch_stem2 = gr.Audio(
478
- show_download_button = True,
479
- interactive = False,
480
- type = "filepath",
481
- label = "Stem 2"
482
- )
483
-
484
- 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])
485
-
486
- with gr.TabItem("Demucs"):
487
- with gr.Row():
488
- demucs_model = gr.Dropdown(
489
- label = "Select the Model",
490
- choices = demucs_models,
491
- interactive = True
492
- )
493
- demucs_output_format = gr.Dropdown(
494
- label = "Select the Output Format",
495
- choices = output_format,
496
- interactive = True
497
- )
498
- with gr.Row():
499
- demucs_shifts = gr.Slider(
500
- minimum = 1,
501
- maximum = 20,
502
- step = 1,
503
- label = "Shifts",
504
- info = "Number of predictions with random shifts, higher = slower but better quality.",
505
- value = 2,
506
- interactive = True
507
- )
508
- demucs_overlap = gr.Dropdown(
509
- label = "Overlap",
510
- choices = demucs_overlap_values,
511
- value = demucs_overlap_values[0],
512
- interactive = True
513
- )
514
- with gr.Row():
515
- demucs_audio = gr.Audio(
516
- label = "Input Audio",
517
- type = "numpy",
518
- interactive = True
519
- )
520
- with gr.Row():
521
- demucs_button = gr.Button("Separate!", variant = "primary")
522
- with gr.Row():
523
- demucs_stem1 = gr.Audio(
524
- show_download_button = True,
525
- interactive = False,
526
- type = "filepath",
527
- label = "Stem 1"
528
- )
529
- demucs_stem2 = gr.Audio(
530
- show_download_button = True,
531
- interactive = False,
532
- type = "filepath",
533
- label = "Stem 2"
534
- )
535
- with gr.Row():
536
- demucs_stem3 = gr.Audio(
537
- show_download_button = True,
538
- interactive = False,
539
- type = "filepath",
540
- label = "Stem 3"
541
- )
542
- demucs_stem4 = gr.Audio(
543
- show_download_button = True,
544
- interactive = False,
545
- type = "filepath",
546
- label = "Stem 4"
547
- )
548
-
549
- demucs_button.click(demucs_separator, [demucs_audio, demucs_model, demucs_output_format, demucs_shifts, demucs_overlap], [demucs_stem1, demucs_stem2, demucs_stem3, demucs_stem4])
550
-
551
- with gr.TabItem("Credits"):
552
- gr.Markdown(
553
- """
554
- UVR5 UI created by **[Eddycrack 864](https://github.com/Eddycrack864).** Join **[AI HUB](https://discord.gg/aihub)** community.
555
-
556
- * python-audio-separator by [beveradb](https://github.com/beveradb).
557
- * Special thanks to [Ilaria](https://github.com/TheStingerX) for hosting this space and help.
558
- * Thanks to [Mikus](https://github.com/cappuch) for the help with the code.
559
- * Thanks to [Nick088](https://huggingface.co/Nick088) for the help to fix roformers.
560
- * Improvements by [Blane187](https://huggingface.co/Blane187).
561
-
562
- You can donate to the original UVR5 project here:
563
- [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/uvr5)
564
- """
565
- )
566
-
567
- app.queue()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
568
  app.launch()
 
1
+ import os
2
+ import re
3
+ import random
4
+ from scipy.io.wavfile import write
5
+ from scipy.io.wavfile import read
6
+ import numpy as np
7
+ import gradio as gr
8
+ import yt_dlp
9
+
10
+ roformer_models = {
11
+ 'BS-Roformer-Viperx-1297.ckpt': 'model_bs_roformer_ep_317_sdr_12.9755.ckpt',
12
+ 'BS-Roformer-Viperx-1296.ckpt': 'model_bs_roformer_ep_368_sdr_12.9628.ckpt',
13
+ 'BS-Roformer-Viperx-1053.ckpt': 'model_bs_roformer_ep_937_sdr_10.5309.ckpt',
14
+ 'Mel-Roformer-Viperx-1143.ckpt': 'model_mel_band_roformer_ep_3005_sdr_11.4360.ckpt'
15
+ }
16
+
17
+ mdx23c_models = [
18
+ 'MDX23C_D1581.ckpt',
19
+ 'MDX23C-8KFFT-InstVoc_HQ.ckpt',
20
+ 'MDX23C-8KFFT-InstVoc_HQ_2.ckpt',
21
+ ]
22
+
23
+ mdxnet_models = [
24
+ 'UVR-MDX-NET-Inst_full_292.onnx',
25
+ 'UVR-MDX-NET_Inst_187_beta.onnx',
26
+ 'UVR-MDX-NET_Inst_82_beta.onnx',
27
+ 'UVR-MDX-NET_Inst_90_beta.onnx',
28
+ 'UVR-MDX-NET_Main_340.onnx',
29
+ 'UVR-MDX-NET_Main_390.onnx',
30
+ 'UVR-MDX-NET_Main_406.onnx',
31
+ 'UVR-MDX-NET_Main_427.onnx',
32
+ 'UVR-MDX-NET_Main_438.onnx',
33
+ 'UVR-MDX-NET-Inst_HQ_1.onnx',
34
+ 'UVR-MDX-NET-Inst_HQ_2.onnx',
35
+ 'UVR-MDX-NET-Inst_HQ_3.onnx',
36
+ 'UVR-MDX-NET-Inst_HQ_4.onnx',
37
+ 'UVR_MDXNET_Main.onnx',
38
+ 'UVR-MDX-NET-Inst_Main.onnx',
39
+ 'UVR_MDXNET_1_9703.onnx',
40
+ 'UVR_MDXNET_2_9682.onnx',
41
+ 'UVR_MDXNET_3_9662.onnx',
42
+ 'UVR-MDX-NET-Inst_1.onnx',
43
+ 'UVR-MDX-NET-Inst_2.onnx',
44
+ 'UVR-MDX-NET-Inst_3.onnx',
45
+ 'UVR_MDXNET_KARA.onnx',
46
+ 'UVR_MDXNET_KARA_2.onnx',
47
+ 'UVR_MDXNET_9482.onnx',
48
+ 'UVR-MDX-NET-Voc_FT.onnx',
49
+ 'Kim_Vocal_1.onnx',
50
+ 'Kim_Vocal_2.onnx',
51
+ 'Kim_Inst.onnx',
52
+ 'Reverb_HQ_By_FoxJoy.onnx',
53
+ 'UVR-MDX-NET_Crowd_HQ_1.onnx',
54
+ 'kuielab_a_vocals.onnx',
55
+ 'kuielab_a_other.onnx',
56
+ 'kuielab_a_bass.onnx',
57
+ 'kuielab_a_drums.onnx',
58
+ 'kuielab_b_vocals.onnx',
59
+ 'kuielab_b_other.onnx',
60
+ 'kuielab_b_bass.onnx',
61
+ 'kuielab_b_drums.onnx',
62
+ ]
63
+
64
+ vrarch_models = [
65
+ '1_HP-UVR.pth',
66
+ '2_HP-UVR.pth',
67
+ '3_HP-Vocal-UVR.pth',
68
+ '4_HP-Vocal-UVR.pth',
69
+ '5_HP-Karaoke-UVR.pth',
70
+ '6_HP-Karaoke-UVR.pth',
71
+ '7_HP2-UVR.pth',
72
+ '8_HP2-UVR.pth',
73
+ '9_HP2-UVR.pth',
74
+ '10_SP-UVR-2B-32000-1.pth',
75
+ '11_SP-UVR-2B-32000-2.pth',
76
+ '12_SP-UVR-3B-44100.pth',
77
+ '13_SP-UVR-4B-44100-1.pth',
78
+ '14_SP-UVR-4B-44100-2.pth',
79
+ '15_SP-UVR-MID-44100-1.pth',
80
+ '16_SP-UVR-MID-44100-2.pth',
81
+ '17_HP-Wind_Inst-UVR.pth',
82
+ 'UVR-De-Echo-Aggressive.pth',
83
+ 'UVR-De-Echo-Normal.pth',
84
+ 'UVR-DeEcho-DeReverb.pth',
85
+ 'UVR-DeNoise-Lite.pth',
86
+ 'UVR-DeNoise.pth',
87
+ 'UVR-BVE-4B_SN-44100-1.pth',
88
+ 'MGM_HIGHEND_v4.pth',
89
+ 'MGM_LOWEND_A_v4.pth',
90
+ 'MGM_LOWEND_B_v4.pth',
91
+ 'MGM_MAIN_v4.pth',
92
+ ]
93
+
94
+ demucs_models = [
95
+ 'htdemucs_ft.yaml',
96
+ 'htdemucs.yaml',
97
+ 'hdemucs_mmi.yaml',
98
+ ]
99
+
100
+ output_format = [
101
+ 'wav',
102
+ 'flac',
103
+ 'mp3',
104
+ ]
105
+
106
+ mdxnet_overlap_values = [
107
+ '0.25',
108
+ '0.5',
109
+ '0.75',
110
+ '0.99',
111
+ ]
112
+
113
+ vrarch_window_size_values = [
114
+ '320',
115
+ '512',
116
+ '1024',
117
+ ]
118
+
119
+ demucs_overlap_values = [
120
+ '0.25',
121
+ '0.50',
122
+ '0.75',
123
+ '0.99',
124
+ ]
125
+
126
+ def download_audio(url):
127
+ ydl_opts = {
128
+ 'format': 'bestaudio/best',
129
+ 'outtmpl': 'ytdl/%(title)s.%(ext)s',
130
+ 'postprocessors': [{
131
+ 'key': 'FFmpegExtractAudio',
132
+ 'preferredcodec': 'wav',
133
+ 'preferredquality': '192',
134
+ }],
135
+ }
136
+
137
+ with yt_dlp.YoutubeDL(ydl_opts) as ydl:
138
+ info_dict = ydl.extract_info(url, download=True)
139
+ file_path = ydl.prepare_filename(info_dict).rsplit('.', 1)[0] + '.wav'
140
+ sample_rate, audio_data = read(file_path)
141
+ audio_array = np.asarray(audio_data, dtype=np.int16)
142
+
143
+ return sample_rate, audio_array
144
+
145
+ def roformer_separator(roformer_audio, roformer_model, roformer_output_format, roformer_overlap, roformer_segment_size):
146
+ files_list = []
147
+ files_list.clear()
148
+ directory = "./outputs"
149
+ random_id = str(random.randint(10000, 99999))
150
+ pattern = f"{random_id}"
151
+ os.makedirs("outputs", exist_ok=True)
152
+ write(f'{random_id}.wav', roformer_audio[0], roformer_audio[1])
153
+ full_roformer_model = roformer_models[roformer_model]
154
+ 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}"
155
+ os.system(prompt)
156
+
157
+ for file in os.listdir(directory):
158
+ if re.search(pattern, file):
159
+ files_list.append(os.path.join(directory, file))
160
+
161
+ stem1_file = files_list[0]
162
+ stem2_file = files_list[1]
163
+
164
+ return stem1_file, stem2_file
165
+
166
+ def mdxc_separator(mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segment_size, mdx23c_overlap, mdx23c_denoise):
167
+ files_list = []
168
+ files_list.clear()
169
+ directory = "./outputs"
170
+ random_id = str(random.randint(10000, 99999))
171
+ pattern = f"{random_id}"
172
+ os.makedirs("outputs", exist_ok=True)
173
+ write(f'{random_id}.wav', mdx23c_audio[0], mdx23c_audio[1])
174
+ 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}"
175
+
176
+ if mdx23c_denoise:
177
+ prompt += " --mdx_enable_denoise"
178
+
179
+ os.system(prompt)
180
+
181
+ for file in os.listdir(directory):
182
+ if re.search(pattern, file):
183
+ files_list.append(os.path.join(directory, file))
184
+
185
+ stem1_file = files_list[0]
186
+ stem2_file = files_list[1]
187
+
188
+ return stem1_file, stem2_file
189
+
190
+ def mdxnet_separator(mdxnet_audio, mdxnet_model, mdxnet_output_format, mdxnet_segment_size, mdxnet_overlap, mdxnet_denoise):
191
+ files_list = []
192
+ files_list.clear()
193
+ directory = "./outputs"
194
+ random_id = str(random.randint(10000, 99999))
195
+ pattern = f"{random_id}"
196
+ os.makedirs("outputs", exist_ok=True)
197
+ write(f'{random_id}.wav', mdxnet_audio[0], mdxnet_audio[1])
198
+ prompt = f"audio-separator {random_id}.wav --model_filename {mdxnet_model} --output_dir=./outputs --output_format={mdxnet_output_format} --normalization=0.9 --mdx_segment_size={mdxnet_segment_size} --mdx_overlap={mdxnet_overlap}"
199
+
200
+ if mdxnet_denoise:
201
+ prompt += " --mdx_enable_denoise"
202
+
203
+ os.system(prompt)
204
+
205
+ for file in os.listdir(directory):
206
+ if re.search(pattern, file):
207
+ files_list.append(os.path.join(directory, file))
208
+
209
+ stem1_file = files_list[0]
210
+ stem2_file = files_list[1]
211
+
212
+ return stem1_file, stem2_file
213
+
214
+ def vrarch_separator(vrarch_audio, vrarch_model, vrarch_output_format, vrarch_window_size, vrarch_agression, vrarch_tta, vrarch_high_end_process):
215
+ files_list = []
216
+ files_list.clear()
217
+ directory = "./outputs"
218
+ random_id = str(random.randint(10000, 99999))
219
+ pattern = f"{random_id}"
220
+ os.makedirs("outputs", exist_ok=True)
221
+ write(f'{random_id}.wav', vrarch_audio[0], vrarch_audio[1])
222
+ 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}"
223
+
224
+ if vrarch_tta:
225
+ prompt += " --vr_enable_tta"
226
+ if vrarch_high_end_process:
227
+ prompt += " --vr_high_end_process"
228
+
229
+ os.system(prompt)
230
+
231
+ for file in os.listdir(directory):
232
+ if re.search(pattern, file):
233
+ files_list.append(os.path.join(directory, file))
234
+
235
+ stem1_file = files_list[0]
236
+ stem2_file = files_list[1]
237
+
238
+ return stem1_file, stem2_file
239
+
240
+ def demucs_separator(demucs_audio, demucs_model, demucs_output_format, demucs_shifts, demucs_overlap):
241
+ files_list = []
242
+ files_list.clear()
243
+ directory = "./outputs"
244
+ random_id = str(random.randint(10000, 99999))
245
+ pattern = f"{random_id}"
246
+ os.makedirs("outputs", exist_ok=True)
247
+ write(f'{random_id}.wav', demucs_audio[0], demucs_audio[1])
248
+ 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}"
249
+
250
+ os.system(prompt)
251
+
252
+ for file in os.listdir(directory):
253
+ if re.search(pattern, file):
254
+ files_list.append(os.path.join(directory, file))
255
+
256
+ stem1_file = files_list[0]
257
+ stem2_file = files_list[1]
258
+ stem3_file = files_list[2]
259
+ stem4_file = files_list[3]
260
+
261
+ return stem1_file, stem2_file, stem3_file, stem4_file
262
+
263
+ with gr.Blocks(theme="NoCrypt/[email protected]", title="🎵 UVR5 UI 🎵") as app:
264
+ gr.Markdown("<h1> 🎵 UVR5 UI 🎵 </h1>")
265
+ gr.Markdown("If you liked this HF Space you can give me a ❤️")
266
+ gr.Markdown("Try UVR5 UI using Colab [here](https://colab.research.google.com/github/Eddycrack864/UVR5-UI/blob/main/UVR_UI.ipynb)")
267
+ with gr.Tabs():
268
+ with gr.TabItem("BS/Mel Roformer"):
269
+ with gr.Row():
270
+ roformer_model = gr.Dropdown(
271
+ label = "Select the Model",
272
+ choices=list(roformer_models.keys()),
273
+ interactive = True
274
+ )
275
+ roformer_output_format = gr.Dropdown(
276
+ label = "Select the Output Format",
277
+ choices = output_format,
278
+ interactive = True
279
+ )
280
+ with gr.Row():
281
+ roformer_overlap = gr.Slider(
282
+ minimum = 2,
283
+ maximum = 4,
284
+ step = 1,
285
+ label = "Overlap",
286
+ info = "Amount of overlap between prediction windows.",
287
+ value = 4,
288
+ interactive = True
289
+ )
290
+ roformer_segment_size = gr.Slider(
291
+ minimum = 32,
292
+ maximum = 4000,
293
+ step = 32,
294
+ label = "Segment Size",
295
+ info = "Larger consumes more resources, but may give better results.",
296
+ value = 256,
297
+ interactive = True
298
+ )
299
+ with gr.Row():
300
+ roformer_audio = gr.Audio(
301
+ label = "Input Audio",
302
+ type = "numpy",
303
+ interactive = True
304
+ )
305
+ with gr.Accordion("Separation by Link", open = False):
306
+ with gr.Row():
307
+ roformer_link = gr.Textbox(
308
+ label = "Link",
309
+ placeholder = "Paste the link here",
310
+ interactive = True
311
+ )
312
+ with gr.Row():
313
+ 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)")
314
+ with gr.Row():
315
+ roformer_download_button = gr.Button(
316
+ "Download!",
317
+ variant = "primary"
318
+ )
319
+
320
+ roformer_download_button.click(download_audio, [roformer_link], [roformer_audio])
321
+
322
+ with gr.Row():
323
+ roformer_button = gr.Button("Separate!", variant = "primary")
324
+ with gr.Row():
325
+ roformer_stem1 = gr.Audio(
326
+ show_download_button = True,
327
+ interactive = False,
328
+ label = "Stem 1",
329
+ type = "filepath"
330
+ )
331
+ roformer_stem2 = gr.Audio(
332
+ show_download_button = True,
333
+ interactive = False,
334
+ label = "Stem 2",
335
+ type = "filepath"
336
+ )
337
+
338
+ roformer_button.click(roformer_separator, [roformer_audio, roformer_model, roformer_output_format, roformer_overlap, roformer_segment_size], [roformer_stem1, roformer_stem2])
339
+
340
+ with gr.TabItem("MDX23C"):
341
+ with gr.Row():
342
+ mdx23c_model = gr.Dropdown(
343
+ label = "Select the Model",
344
+ choices = mdx23c_models,
345
+ interactive = True
346
+ )
347
+ mdx23c_output_format = gr.Dropdown(
348
+ label = "Select the Output Format",
349
+ choices = output_format,
350
+ interactive = True
351
+ )
352
+ with gr.Row():
353
+ mdx23c_segment_size = gr.Slider(
354
+ minimum = 32,
355
+ maximum = 4000,
356
+ step = 32,
357
+ label = "Segment Size",
358
+ info = "Larger consumes more resources, but may give better results.",
359
+ value = 256,
360
+ interactive = True
361
+ )
362
+ mdx23c_overlap = gr.Slider(
363
+ minimum = 2,
364
+ maximum = 50,
365
+ step = 1,
366
+ label = "Overlap",
367
+ info = "Amount of overlap between prediction windows.",
368
+ value = 8,
369
+ interactive = True
370
+ )
371
+ mdx23c_denoise = gr.Checkbox(
372
+ label = "Denoise",
373
+ info = "Enable denoising during separation.",
374
+ value = False,
375
+ interactive = True
376
+ )
377
+ with gr.Row():
378
+ mdx23c_audio = gr.Audio(
379
+ label = "Input Audio",
380
+ type = "numpy",
381
+ interactive = True
382
+ )
383
+ with gr.Accordion("Separation by Link", open = False):
384
+ with gr.Row():
385
+ mdx23c_link = gr.Textbox(
386
+ label = "Link",
387
+ placeholder = "Paste the link here",
388
+ interactive = True
389
+ )
390
+ with gr.Row():
391
+ 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)")
392
+ with gr.Row():
393
+ mdx23c_download_button = gr.Button(
394
+ "Download!",
395
+ variant = "primary"
396
+ )
397
+
398
+ mdx23c_download_button.click(download_audio, [mdx23c_link], [mdx23c_audio])
399
+
400
+ with gr.Row():
401
+ mdx23c_button = gr.Button("Separate!", variant = "primary")
402
+ with gr.Row():
403
+ mdx23c_stem1 = gr.Audio(
404
+ show_download_button = True,
405
+ interactive = False,
406
+ label = "Stem 1",
407
+ type = "filepath"
408
+ )
409
+ mdx23c_stem2 = gr.Audio(
410
+ show_download_button = True,
411
+ interactive = False,
412
+ label = "Stem 2",
413
+ type = "filepath"
414
+ )
415
+
416
+ mdx23c_button.click(mdxc_separator, [mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segment_size, mdx23c_overlap, mdx23c_denoise], [mdx23c_stem1, mdx23c_stem2])
417
+
418
+ with gr.TabItem("MDX-NET"):
419
+ with gr.Row():
420
+ mdxnet_model = gr.Dropdown(
421
+ label = "Select the Model",
422
+ choices = mdxnet_models,
423
+ interactive = True
424
+ )
425
+ mdxnet_output_format = gr.Dropdown(
426
+ label = "Select the Output Format",
427
+ choices = output_format,
428
+ interactive = True
429
+ )
430
+ with gr.Row():
431
+ mdxnet_segment_size = gr.Slider(
432
+ minimum = 32,
433
+ maximum = 4000,
434
+ step = 32,
435
+ label = "Segment Size",
436
+ info = "Larger consumes more resources, but may give better results.",
437
+ value = 256,
438
+ interactive = True
439
+ )
440
+ mdxnet_overlap = gr.Dropdown(
441
+ label = "Overlap",
442
+ choices = mdxnet_overlap_values,
443
+ value = mdxnet_overlap_values[0],
444
+ interactive = True
445
+ )
446
+ mdxnet_denoise = gr.Checkbox(
447
+ label = "Denoise",
448
+ info = "Enable denoising during separation.",
449
+ value = True,
450
+ interactive = True
451
+ )
452
+ with gr.Row():
453
+ mdxnet_audio = gr.Audio(
454
+ label = "Input Audio",
455
+ type = "numpy",
456
+ interactive = True
457
+ )
458
+ with gr.Accordion("Separation by Link", open = False):
459
+ with gr.Row():
460
+ mdxnet_link = gr.Textbox(
461
+ label = "Link",
462
+ placeholder = "Paste the link here",
463
+ interactive = True
464
+ )
465
+ with gr.Row():
466
+ 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)")
467
+ with gr.Row():
468
+ mdxnet_download_button = gr.Button(
469
+ "Download!",
470
+ variant = "primary"
471
+ )
472
+
473
+ mdxnet_download_button.click(download_audio, [mdxnet_link], [mdxnet_audio])
474
+
475
+ with gr.Row():
476
+ mdxnet_button = gr.Button("Separate!", variant = "primary")
477
+ with gr.Row():
478
+ mdxnet_stem1 = gr.Audio(
479
+ show_download_button = True,
480
+ interactive = False,
481
+ label = "Stem 1",
482
+ type = "filepath"
483
+ )
484
+ mdxnet_stem2 = gr.Audio(
485
+ show_download_button = True,
486
+ interactive = False,
487
+ label = "Stem 2",
488
+ type = "filepath"
489
+ )
490
+
491
+ mdxnet_button.click(mdxnet_separator, [mdxnet_audio, mdxnet_model, mdxnet_output_format, mdxnet_segment_size, mdxnet_overlap, mdxnet_denoise], [mdxnet_stem1, mdxnet_stem2])
492
+
493
+ with gr.TabItem("VR ARCH"):
494
+ with gr.Row():
495
+ vrarch_model = gr.Dropdown(
496
+ label = "Select the Model",
497
+ choices = vrarch_models,
498
+ interactive = True
499
+ )
500
+ vrarch_output_format = gr.Dropdown(
501
+ label = "Select the Output Format",
502
+ choices = output_format,
503
+ interactive = True
504
+ )
505
+ with gr.Row():
506
+ vrarch_window_size = gr.Dropdown(
507
+ label = "Window Size",
508
+ choices = vrarch_window_size_values,
509
+ value = vrarch_window_size_values[0],
510
+ interactive = True
511
+ )
512
+ vrarch_agression = gr.Slider(
513
+ minimum = 1,
514
+ maximum = 50,
515
+ step = 1,
516
+ label = "Agression",
517
+ info = "Intensity of primary stem extraction.",
518
+ value = 5,
519
+ interactive = True
520
+ )
521
+ vrarch_tta = gr.Checkbox(
522
+ label = "TTA",
523
+ info = "Enable Test-Time-Augmentation; slow but improves quality.",
524
+ value = True,
525
+ visible = True,
526
+ interactive = True,
527
+ )
528
+ vrarch_high_end_process = gr.Checkbox(
529
+ label = "High End Process",
530
+ info = "Mirror the missing frequency range of the output.",
531
+ value = False,
532
+ visible = True,
533
+ interactive = True,
534
+ )
535
+ with gr.Row():
536
+ vrarch_audio = gr.Audio(
537
+ label = "Input Audio",
538
+ type = "numpy",
539
+ interactive = True
540
+ )
541
+ with gr.Accordion("Separation by Link", open = False):
542
+ with gr.Row():
543
+ vrarch_link = gr.Textbox(
544
+ label = "Link",
545
+ placeholder = "Paste the link here",
546
+ interactive = True
547
+ )
548
+ with gr.Row():
549
+ 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)")
550
+ with gr.Row():
551
+ vrarch_download_button = gr.Button(
552
+ "Download!",
553
+ variant = "primary"
554
+ )
555
+
556
+ vrarch_download_button.click(download_audio, [vrarch_link], [vrarch_audio])
557
+
558
+ with gr.Row():
559
+ vrarch_button = gr.Button("Separate!", variant = "primary")
560
+ with gr.Row():
561
+ vrarch_stem1 = gr.Audio(
562
+ show_download_button = True,
563
+ interactive = False,
564
+ type = "filepath",
565
+ label = "Stem 1"
566
+ )
567
+ vrarch_stem2 = gr.Audio(
568
+ show_download_button = True,
569
+ interactive = False,
570
+ type = "filepath",
571
+ label = "Stem 2"
572
+ )
573
+
574
+ 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])
575
+
576
+ with gr.TabItem("Demucs"):
577
+ with gr.Row():
578
+ demucs_model = gr.Dropdown(
579
+ label = "Select the Model",
580
+ choices = demucs_models,
581
+ interactive = True
582
+ )
583
+ demucs_output_format = gr.Dropdown(
584
+ label = "Select the Output Format",
585
+ choices = output_format,
586
+ interactive = True
587
+ )
588
+ with gr.Row():
589
+ demucs_shifts = gr.Slider(
590
+ minimum = 1,
591
+ maximum = 20,
592
+ step = 1,
593
+ label = "Shifts",
594
+ info = "Number of predictions with random shifts, higher = slower but better quality.",
595
+ value = 2,
596
+ interactive = True
597
+ )
598
+ demucs_overlap = gr.Dropdown(
599
+ label = "Overlap",
600
+ choices = demucs_overlap_values,
601
+ value = demucs_overlap_values[0],
602
+ interactive = True
603
+ )
604
+ with gr.Row():
605
+ demucs_audio = gr.Audio(
606
+ label = "Input Audio",
607
+ type = "numpy",
608
+ interactive = True
609
+ )
610
+ with gr.Accordion("Separation by Link", open = False):
611
+ with gr.Row():
612
+ demucs_link = gr.Textbox(
613
+ label = "Link",
614
+ placeholder = "Paste the link here",
615
+ interactive = True
616
+ )
617
+ with gr.Row():
618
+ 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)")
619
+ with gr.Row():
620
+ demucs_download_button = gr.Button(
621
+ "Download!",
622
+ variant = "primary"
623
+ )
624
+
625
+ demucs_download_button.click(download_audio, [demucs_link], [demucs_audio])
626
+
627
+ with gr.Row():
628
+ demucs_button = gr.Button("Separate!", variant = "primary")
629
+ with gr.Row():
630
+ demucs_stem1 = gr.Audio(
631
+ show_download_button = True,
632
+ interactive = False,
633
+ type = "filepath",
634
+ label = "Stem 1"
635
+ )
636
+ demucs_stem2 = gr.Audio(
637
+ show_download_button = True,
638
+ interactive = False,
639
+ type = "filepath",
640
+ label = "Stem 2"
641
+ )
642
+ with gr.Row():
643
+ demucs_stem3 = gr.Audio(
644
+ show_download_button = True,
645
+ interactive = False,
646
+ type = "filepath",
647
+ label = "Stem 3"
648
+ )
649
+ demucs_stem4 = gr.Audio(
650
+ show_download_button = True,
651
+ interactive = False,
652
+ type = "filepath",
653
+ label = "Stem 4"
654
+ )
655
+
656
+ demucs_button.click(demucs_separator, [demucs_audio, demucs_model, demucs_output_format, demucs_shifts, demucs_overlap], [demucs_stem1, demucs_stem2, demucs_stem3, demucs_stem4])
657
+
658
+ with gr.TabItem("Credits"):
659
+ gr.Markdown(
660
+ """
661
+ UVR5 UI created by **[Eddycrack 864](https://github.com/Eddycrack864).** Join **[AI HUB](https://discord.gg/aihub)** community.
662
+ * python-audio-separator by [beveradb](https://github.com/beveradb).
663
+ * Special thanks to [Ilaria](https://github.com/TheStingerX) for hosting this space and help.
664
+ * Thanks to [Mikus](https://github.com/cappuch) for the help with the code.
665
+ * Thanks to [Nick088](https://huggingface.co/Nick088) for the help to fix roformers.
666
+ * Thanks to [yt_dlp](https://github.com/yt-dlp/yt-dlp) devs.
667
+ * Separation by link source code and improvements by [Blane187](https://huggingface.co/Blane187).
668
+
669
+ You can donate to the original UVR5 project here:
670
+ [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/uvr5)
671
+ """
672
+ )
673
+
674
+ app.queue()
675
  app.launch()