Spaces:
Sleeping
Sleeping
import os | |
import glob | |
from pathlib import Path | |
import gradio as gr | |
roformer_models = [ | |
'BS-Roformer-Viperx-1297.ckpt', | |
'BS-Roformer-Viperx-1296.ckpt', | |
'BS-Roformer-Viperx-1053.ckpt', | |
'Mel-Roformer-Viperx-1143.ckpt', | |
] | |
mdx23c_models = [ | |
'MDX23C_D1581.ckpt', | |
'MDX23C-8KFFT-InstVoc_HQ.ckpt', | |
'MDX23C-8KFFT-InstVoc_HQ_2.ckpt', | |
] | |
mdxnet_models = [ | |
'UVR-MDX-NET-Inst_full_292.onnx', | |
'UVR-MDX-NET_Inst_187_beta.onnx', | |
'UVR-MDX-NET_Inst_82_beta.onnx', | |
'UVR-MDX-NET_Inst_90_beta.onnx', | |
'UVR-MDX-NET_Main_340.onnx', | |
'UVR-MDX-NET_Main_390.onnx', | |
'UVR-MDX-NET_Main_406.onnx', | |
'UVR-MDX-NET_Main_427.onnx', | |
'UVR-MDX-NET_Main_438.onnx', | |
'UVR-MDX-NET-Inst_HQ_1.onnx', | |
'UVR-MDX-NET-Inst_HQ_2.onnx', | |
'UVR-MDX-NET-Inst_HQ_3.onnx', | |
'UVR-MDX-NET-Inst_HQ_4.onnx', | |
'UVR_MDXNET_Main.onnx', | |
'UVR-MDX-NET-Inst_Main.onnx', | |
'UVR_MDXNET_1_9703.onnx', | |
'UVR_MDXNET_2_9682.onnx', | |
'UVR_MDXNET_3_9662.onnx', | |
'UVR-MDX-NET-Inst_1.onnx', | |
'UVR-MDX-NET-Inst_2.onnx', | |
'UVR-MDX-NET-Inst_3.onnx', | |
'UVR_MDXNET_KARA.onnx', | |
'UVR_MDXNET_KARA_2.onnx', | |
'UVR_MDXNET_9482.onnx', | |
'UVR-MDX-NET-Voc_FT.onnx', | |
'Kim_Vocal_1.onnx', | |
'Kim_Vocal_2.onnx', | |
'Kim_Inst.onnx', | |
'Reverb_HQ_By_FoxJoy.onnx', | |
'UVR-MDX-NET_Crowd_HQ_1.onnx', | |
'kuielab_a_vocals.onnx', | |
'kuielab_a_other.onnx', | |
'kuielab_a_bass.onnx', | |
'kuielab_a_drums.onnx', | |
'kuielab_b_vocals.onnx', | |
'kuielab_b_other.onnx', | |
'kuielab_b_bass.onnx', | |
'kuielab_b_drums.onnx', | |
] | |
vrarch_models = [ | |
'1_HP-UVR.pth', | |
'2_HP-UVR.pth', | |
'3_HP-Vocal-UVR.pth', | |
'4_HP-Vocal-UVR.pth', | |
'5_HP-Karaoke-UVR.pth', | |
'6_HP-Karaoke-UVR.pth', | |
'7_HP2-UVR.pth', | |
'8_HP2-UVR.pth', | |
'9_HP2-UVR.pth', | |
'10_SP-UVR-2B-32000-1.pth', | |
'11_SP-UVR-2B-32000-2.pth', | |
'12_SP-UVR-3B-44100.pth', | |
'13_SP-UVR-4B-44100-1.pth', | |
'14_SP-UVR-4B-44100-2.pth', | |
'15_SP-UVR-MID-44100-1.pth', | |
'16_SP-UVR-MID-44100-2.pth', | |
'17_HP-Wind_Inst-UVR.pth', | |
'UVR-De-Echo-Aggressive.pth', | |
'UVR-De-Echo-Normal.pth', | |
'UVR-DeEcho-DeReverb.pth', | |
'UVR-DeNoise-Lite.pth', | |
'UVR-DeNoise.pth', | |
'UVR-BVE-4B_SN-44100-1.pth', | |
'MGM_HIGHEND_v4.pth', | |
'MGM_LOWEND_A_v4.pth', | |
'MGM_LOWEND_B_v4.pth', | |
'MGM_MAIN_v4.pth', | |
] | |
demucs_models = [ | |
'htdemucs_ft.yaml', | |
'htdemucs.yaml', | |
'hdemucs_mmi.yaml', | |
'htdemucs_6s.yaml', | |
] | |
output_format = [ | |
'wav', | |
'flac', | |
'mp3', | |
] | |
mdxnet_overlap_values = [ | |
'0.25', | |
'0.5', | |
'0.75', | |
'0.99', | |
] | |
vrarch_window_size_values = [ | |
'320', | |
'512', | |
'1024', | |
] | |
with gr.Blocks(title="🎵 UVR5 UI 🎵") as app: | |
gr.Markdown("<h1> 🎵 UVR5 UI 🎵 </h1>") | |
with gr.Tabs(): | |
with gr.TabItem("BS-Roformer"): | |
with gr.Row(): | |
roformer_model = gr.Dropdown( | |
label = "Select the Model", | |
choices = roformer_models, | |
interactive = True | |
) | |
roformer_output_format = gr.Dropdown( | |
label = "Select the Output Format", | |
choices = output_format, | |
interactive = True | |
) | |
with gr.Row(): | |
roformer_overlap = gr.Slider( | |
minimum = 2, | |
maximum = 4, | |
step = 1, | |
label = "Overlap", | |
info = "Amount of overlap between prediction windows.", | |
value = 4, | |
interactive = True | |
) | |
with gr.Row(): | |
roformer_audio = gr.Audio( | |
label = "Input Audio", | |
interactive = True | |
) | |
with gr.Row(): | |
roformer_button = gr.Button("Separate", variant = "primary") #revisar esto | |
#resto del codigo de lo que hace el boton | |
with gr.Row(): | |
roformer_stem_1 = gr.Audio( | |
show_download_button = True, | |
interactive = False, | |
label = "Stem 1" | |
) | |
roformer_stem_2 = gr.Audio( | |
show_download_button = True, | |
interactive = False, | |
label = "Stem 2" | |
) | |
with gr.Row(): | |
roformer_status = gr.Textbox( | |
label = "Output Information", | |
interactive = False | |
#añadir algo que muestre aqui todo | |
) | |
with gr.TabItem("MDX23C"): | |
with gr.Row(): | |
mdx23c_model = gr.Dropdown( | |
label = "Select the Model", | |
choices = mdx23c_models, | |
interactive = True | |
) | |
mdx23c_output_format = gr.Dropdown( | |
label = "Select the Output Format", | |
choices = output_format, | |
interactive = True | |
) | |
with gr.Row(): | |
mdx23c_segment_size = gr.Slider( | |
minimum = 32, | |
maximum = 4000, | |
step = 32, | |
label = "Segment Size", | |
info = "Larger consumes more resources, but may give better results.", | |
value = 256, | |
interactive = True | |
) | |
mdx23c_overlap = gr.Slider( | |
minimum = 2, | |
maximum = 50, | |
step = 1, | |
label = "Overlap", | |
info = "Amount of overlap between prediction windows.", | |
value = 8, | |
interactive = True | |
) | |
with gr.Row(): | |
mdx23c_audio = gr.Audio( | |
label = "Input Audio", | |
interactive = True | |
) | |
with gr.Row(): | |
mdx23c_button = gr.Button("Separate", variant = "primary") #revisar esto | |
#resto del codigo de lo que hace el boton | |
with gr.Row(): | |
mdx23c_stem_1 = gr.Audio( | |
show_download_button = True, | |
interactive = False, | |
label = "Stem 1" | |
) | |
mdx23c_stem_2 = gr.Audio( | |
show_download_button = True, | |
interactive = False, | |
label = "Stem 2" | |
) | |
with gr.Row(): | |
mdx23c_status = gr.Textbox( | |
label = "Output Information", | |
interactive = False | |
#añadir algo que muestre aqui todo | |
) | |
with gr.TabItem("MDX-NET"): | |
with gr.Row(): | |
mdxnet_model = gr.Dropdown( | |
label = "Select the Model", | |
choices = mdxnet_models, | |
interactive = True | |
) | |
mdxnet_output_format = gr.Dropdown( | |
label = "Select the Output Format", | |
choices = output_format, | |
interactive = True | |
) | |
with gr.Row(): | |
mdxnet_segment_size = gr.Slider( | |
minimum = 32, | |
maximum = 4000, | |
step = 32, | |
label = "Segment Size", | |
info = "Larger consumes more resources, but may give better results.", | |
value = 256, | |
interactive = True | |
) | |
mdxnet_overlap = gr.Dropdown( | |
label = "Overlap", | |
choices = mdxnet_overlap_values, | |
value = mdxnet_overlap_values[0], | |
interactive = True | |
) | |
mdxnet_denoise = gr.Checkbox( | |
label = "Denoise", | |
info = "Enable denoising during separation.", | |
value = True, | |
interactive = True | |
) | |
with gr.Row(): | |
mdxnet_audio = gr.Audio( | |
label = "Input Audio", | |
interactive = True | |
) | |
with gr.Row(): | |
mdxnet_button = gr.Button("Separate", variant = "primary") #revisar esto | |
#resto del codigo de lo que hace el boton | |
with gr.Row(): | |
mdxnet_stem_1 = gr.Audio( | |
show_download_button = True, | |
interactive = False, | |
label = "Stem 1" | |
) | |
mdxnet_stem_2 = gr.Audio( | |
show_download_button = True, | |
interactive = False, | |
label = "Stem 2" | |
) | |
with gr.Row(): | |
mdxnet_status = gr.Textbox( | |
label = "Output Information", | |
interactive = False | |
#añadir algo que muestre aqui todo | |
) | |
with gr.TabItem("VR ARCH"): | |
with gr.Row(): | |
vrarch_model = gr.Dropdown( | |
label = "Select the Model", | |
choices = vrarch_models, | |
interactive = True | |
) | |
vrarch_output_format = gr.Dropdown( | |
label = "Select the Output Format", | |
choices = output_format, | |
interactive = True | |
) | |
with gr.Row(): | |
vrarch_window_size = gr.Dropdown( | |
label = "Window Size", | |
choices = vrarch_window_size_values, | |
value = vrarch_window_size_values[0], | |
interactive = True | |
) | |
vrarch_agression = gr.Slider( | |
minimum = 1, | |
maximum = 50, | |
step = 1, | |
label = "Agression", | |
info = "Intensity of primary stem extraction.", | |
value = 5, | |
interactive = True | |
) | |
vrarch_tta = gr.Checkbox( | |
label = "TTA", | |
info = "Enable Test-Time-Augmentation; slow but improves quality.", | |
value = True, | |
interactive = True | |
) | |
vrarch_high_end_process = gr.Checkbox( | |
label = "High End Process", | |
info = "Mirror the missing frequency range of the output.", | |
value = False, | |
interactive = True | |
) | |
with gr.Row(): | |
vrarch_audio = gr.Audio( | |
label = "Input Audio", | |
interactive = True | |
) | |
with gr.Row(): | |
vrarch_button = gr.Button("Separate", variant = "primary") #revisar esto | |
#resto del codigo de lo que hace el boton | |
with gr.Row(): | |
vrarch_stem_1 = gr.Audio( | |
show_download_button = True, | |
interactive = False, | |
label = "Stem 1" | |
) | |
vrarch_stem_2 = gr.Audio( | |
show_download_button = True, | |
interactive = False, | |
label = "Stem 2" | |
) | |
with gr.Row(): | |
vrarch_status = gr.Textbox( | |
label = "Output Information", | |
interactive = False | |
#añadir algo que muestre aqui todo | |
) | |
with gr.TabItem("Demucs"): | |
with gr.Row(): | |
demucs_model = gr.Dropdown( | |
label = "Select the Model", | |
choices = demucs_models, | |
interactive = True | |
) | |
demucs_output_format = gr.Dropdown( | |
label = "Select the Output Format", | |
choices = output_format, | |
interactive = True | |
) | |
with gr.Row(): | |
demucs_shifts = gr.Slider( | |
minimum = 1, | |
maximum = 20, | |
step = 1, | |
label = "Shifts", | |
info = "Number of predictions with random shifts, higher = slower but better quality.", | |
value = 2, | |
interactive = True | |
) | |
demucs_overlap = gr.Slider( | |
minimum = 0.001, | |
maximum = 0.999, | |
step = 0.001, | |
label = "Overlap", | |
info = "Amount of overlap between prediction windows.", | |
value = 0.025, | |
interactive = True | |
) | |
with gr.Row(): | |
demucs_audio = gr.Audio( | |
label = "Input Audio", | |
interactive = True | |
) | |
with gr.Row(): | |
demucs_button = gr.Button("Separate", variant = "primary") #revisar esto | |
#resto del codigo de lo que hace el boton | |
with gr.Row(): | |
demucs_stem_1 = gr.Audio( | |
show_download_button = True, | |
interactive = False, | |
label = "Stem 1" | |
) | |
demucs_stem_2 = gr.Audio( | |
show_download_button = True, | |
interactive = False, | |
label = "Stem 2" | |
) | |
demucs_stem_3 = gr.Audio( | |
show_download_button = True, | |
interactive = False, | |
label = "Stem 3" | |
) | |
demucs_stem_4 = gr.Audio( | |
show_download_button = True, | |
interactive = False, | |
label = "Stem 4" | |
) | |
with gr.Row(): | |
demucs_stem_5 = gr.Audio( | |
show_download_button = True, | |
interactive = False, | |
label = "Stem 5" | |
) | |
demucs_stem_6 = gr.Audio( | |
show_download_button = True, | |
interactive = False, | |
label = "Stem 6" | |
) | |
with gr.Row(): | |
demucs_status = gr.Textbox( | |
label = "Output Information", | |
interactive = False | |
#añadir algo que muestre aqui todo | |
) | |
app.launch() |