Spaces:
Running
Running
File size: 6,604 Bytes
d2fe7fa 25e61d8 d2fe7fa c16d88d d2fe7fa f93f3d6 d2fe7fa bee64dd f1ed355 f93f3d6 bee64dd 19bd433 328b59e 19bd433 bee64dd 328b59e bee64dd 19bd433 bee64dd c16d88d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
import gradio as gr
import os
def clean():
return {"value": "", "__type__": "update"}
weight_root = os.getenv("weight_root")
weight_uvr5_root = os.getenv("weight_uvr5_root")
index_root = os.getenv("index_root")
outside_index_root = os.getenv("outside_index_root")
names = []
for name in os.listdir(weight_root):
if name.endswith(".pth"):
names.append(name)
index_paths = []
with gr.Blocks(title="RVC UI") as app:
gr.Markdown("<center><h1> RVC UI 🗣️")
gr.Markdown("<h1>this ui not done yet!")
models = gr.Dropdown(label="voice model", choices=sorted(names))
with gr.Row():
pith_voice = gr.Number(label="Transpose (integer, number of semitones, raise by an octave: 12, lower by an octave: -12)",value=0)
with gr.Row():
clean_button = gr.Button("Refresh model", variant="primary")
spk_item = gr.Slider(minimum=0,maximum=2333,step=1,label="Select Speaker/Singer ID",value=0,visible=False,interactive=False)
clean_button.click(fn=clean, inputs=[], outputs=[models], api_name="infer_clean")
modelinfo = gr.Textbox(label="Model info", max_lines=8, visible=False)
but0 = gr.Button("Convert", variant="primary")
with gr.Tabs():
with gr.TabItem("Single inference"):
input_audio0 = gr.Audio(label="The audio file to be processed",type="filepath")
file_index1 = gr.File(label="Path to the feature index file. Leave blank to use the selected result from the dropdown")
with gr.Column():
f0method0 = gr.Radio(label="Select the pitch extraction algorithm ('pm': faster extraction but lower-quality speech; 'harvest': better bass but extremely slow; 'crepe': better quality but GPU intensive), 'rmvpe': best quality, and little GPU requirement",choices=(["pm", "dio", "harvest", "crepe", "rmvpe", "fcpe"]),value="rmvpe",interactive=True)
resample_sr0 = gr.Slider(minimum=0,maximum=48000,label="Resample the output audio in post-processing to the final sample rate. Set to 0 for no resampling",value=0,step=1,interactive=True)
rms_mix_rate0 = gr.Slider(minimum=0,maximum=1,label="Adjust the volume envelope scaling. Closer to 0, the more it mimicks the volume of the original vocals. Can help mask noise and make volume sound more natural when set relatively low. Closer to 1 will be more of a consistently loud volume",value=0.25,interactive=True)
protect0 = gr.Slider(minimum=0,maximum=0.5,label="Protect voiceless consonants and breath sounds to prevent artifacts such as tearing in electronic music. Set to 0.5 to disable. Decrease the value to increase protection, but it may reduce indexing accuracy",value=0.33,step=0.01,interactive=True)
filter_radius0 = gr.Slider(minimum=0,maximum=7,label=("If >=3: apply median filtering to the harvested pitch results. The value represents the filter radius and can reduce breathiness."),value=3,step=1,interactive=True)
f0_file = gr.File(label="F0 curve file (optional). One pitch per line. Replaces the default F0 and pitch modulation",visible=False)
vc_output1 = gr.Textbox(label="Output information", interactive=False)
vc_output2 = gr.Audio(label="Export audio (click on the three dots in the lower right corner to download)",type="filepath",interactive=False)
#refresh_button.click(fn=change_choices,inputs=[],outputs=[models, file_index2],api_name="infer_refresh")
with gr.TabItem("Batch inference"):
gr.Markdown(f"<center>Batch conversion\n. Enter the folder containing the audio files to be converted or upload multiple audio files. The converted audio will be output in the specified folder (default: 'opt').")
vc_transform1 = gr.Number(label="Transpose (integer, number of semitones, raise by an octave: 12, lower by an octave: -12)", value=0)
dir_input = gr.Textbox(label="Enter the path of the audio folder to be processed (copy it from the address bar of the file manager)", placeholder="C:\\Users\\Desktop\\input_vocal_dir")
inputs = gr.File(file_count="multiple", label="Multiple audio files can also be imported. If a folder path exists, this input is ignored.")
opt_input = gr.Textbox(label="Specify output folder", value="opt")
file_index4 = gr.Dropdown(label="Auto-detect index path and select from the dropdown", choices=sorted(index_paths), interactive=True)
file_index3 = gr.File(label="Path to the feature index file. Leave blank to use the selected result from the dropdown")
#refresh_button.click(fn=lambda: change_choices()[1],inputs=[],outputs=file_index4,api_name="infer_refresh_batch")
f0method1 = gr.Radio(label="Select the pitch extraction algorithm ('pm': faster extraction but lower-quality speech; 'harvest': better bass but extremely slow; 'crepe': better quality but GPU intensive), 'rmvpe': best quality, and little GPU requirement",choices=(["pm", "harvest", "crepe", "rmvpe", "fcpe"]),value="rmvpe",interactive=True)
resample_sr1 = gr.Slider(minimum=0,maximum=48000,label="Resample the output audio in post-processing to the final sample rate. Set to 0 for no resampling",value=0,step=1,interactive=True)
rms_mix_rate1 = gr.Slider(minimum=0,maximum=1,label="Adjust the volume envelope scaling. Closer to 0, the more it mimicks the volume of the original vocals. Can help mask noise and make volume sound more natural when set relatively low. Closer to 1 will be more of a consistently loud volume",value=1,interactive=True)
protect1 = gr.Slider(minimum=0,maximum=0.5,label=("Protect voiceless consonants and breath sounds to prevent artifacts such as tearing in electronic music. Set to 0.5 to disable. Decrease the value to increase protection, but it may reduce indexing accuracy"),value=0.33,step=0.01,interactive=True)
filter_radius1 = gr.Slider(minimum=0,maximum=7,label="If >=3: apply median filtering to the harvested pitch results. The value represents the filter radius and can reduce breathiness.",value=3,step=1,interactive=True)
index_rate2 = gr.Slider(minimum=0,maximum=1,label="Feature searching ratio",value=1,interactive=True)
format1 = gr.Radio(label="Export file format",choices=["wav", "flac", "mp3", "m4a"],value="wav",interactive=True)
but1 = gr.Button("Convert", variant="primary")
vc_output3 = gr.Textbox(label="Output information",interactive=False)
app.launch()
|