Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
weight_root = os.getenv("weight_root")
|
6 |
+
weight_uvr5_root = os.getenv("weight_uvr5_root")
|
7 |
+
index_root = os.getenv("index_root")
|
8 |
+
outside_index_root = os.getenv("outside_index_root")
|
9 |
+
|
10 |
+
names = []
|
11 |
+
for name in os.listdir(weight_root):
|
12 |
+
if name.endswith(".pth"):
|
13 |
+
names.append(name)
|
14 |
+
index_paths = []
|
15 |
+
|
16 |
+
with gr.Blocks(title="RVC UI") as app:
|
17 |
+
gr.Markdown("<center><h1> RVC UI 🗣️")
|
18 |
+
models = gr.Dropdown(label="voice model", choices=sorted(names))
|
19 |
+
clean_button = gr.Button("Unload model to save GPU memory", variant="primary")
|
20 |
+
spk_item = gr.Slider(minimum=0,maximum=2333,step=1,label="Select Speaker/Singer ID",value=0,visible=False,interactive=False,)
|
21 |
+
clean_button.click(
|
22 |
+
fn=clean, inputs=[], outputs=[sid0], api_name="infer_clean"
|
23 |
+
)
|
24 |
+
modelinfo = gr.Textbox(label="Model info", max_lines=8)
|
25 |
+
with gr.TabItem("Single inference"):
|
26 |
+
pith_voice = gr.Number(label="Transpose (integer, number of semitones, raise by an octave: 12, lower by an octave: -12)",value=0,)
|
27 |
+
input_audio0 = gr.Audio(label="The audio file to be processed",type="filepath")
|
28 |
+
file_index1 = gr.File(label="Path to the feature index file. Leave blank to use the selected result from the dropdown")
|
29 |
+
with gr.Column():
|
30 |
+
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)
|
31 |
+
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)
|
32 |
+
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)
|
33 |
+
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)
|
34 |
+
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)
|
35 |
+
f0_file = gr.File(label="F0 curve file (optional). One pitch per line. Replaces the default F0 and pitch modulation",visible=False,)
|
36 |
+
but0 = gr.Button("Convert", variant="primary")
|
37 |
+
vc_output1 = gr.Textbox(label="Output information")
|
38 |
+
vc_output2 = gr.Audio(label="Export audio (click on the three dots in the lower right corner to download)")
|
39 |
+
refresh_button.click(
|
40 |
+
fn=change_choices,
|
41 |
+
inputs=[],
|
42 |
+
outputs=[sid0, file_index2],
|
43 |
+
api_name="infer_refresh",
|
44 |
+
)
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
app.launch()
|