Spaces:
Build error
Build error
xJuuzouYTx
commited on
Commit
•
a87192b
1
Parent(s):
6238bd4
[ADD] basic functions to inference
Browse files- app.py +32 -5
- inference.py +1 -1
- models/model.py +7 -2
app.py
CHANGED
@@ -46,19 +46,46 @@ def convert_yt_to_wav(url):
|
|
46 |
with gr.Blocks() as app:
|
47 |
gr.HTML("<h1> Simple RVC Inference - by Juuxn 💻 </h1>")
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
with gr.Tab("Inferencia"):
|
50 |
model_url = gr.Textbox(placeholder="https://huggingface.co/AIVER-SE/BillieEilish/resolve/main/BillieEilish.zip", label="Url del modelo", show_label=True)
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
# Salida
|
56 |
with gr.Row():
|
57 |
vc_output1 = gr.Textbox(label="Salida")
|
58 |
vc_output2 = gr.Audio(label="Audio de salida")
|
59 |
|
60 |
btn = gr.Button(value="Convertir")
|
61 |
-
btn.click(infer, inputs=[model_url, f0_method, audio_path], outputs=[vc_output1, vc_output2])
|
62 |
|
63 |
with gr.TabItem("TTS"):
|
64 |
with gr.Row():
|
|
|
46 |
with gr.Blocks() as app:
|
47 |
gr.HTML("<h1> Simple RVC Inference - by Juuxn 💻 </h1>")
|
48 |
|
49 |
+
gr.HTML("<h4> El espacio actual usa solo cpu, así que es solo para inferencia. Se recomienda duplicar el espacio para no tener problemas con las colas de procesamiento. </h4>")
|
50 |
+
gr.Markdown(
|
51 |
+
"[![Duplicate this Space](https://huggingface.co/datasets/huggingface/badges/raw/main/duplicate-this-space-sm-dark.svg)](https://huggingface.co/spaces/juuxn/SimpleRVC?duplicate=true)\n\n"
|
52 |
+
)
|
53 |
+
|
54 |
+
gr.Markdown("Recopilación de modelos que puedes usar: RVC + Kits ai. **[RVC Community Models](https://docs.google.com/spreadsheets/d/1owfUtQuLW9ReiIwg6U9UkkDmPOTkuNHf0OKQtWu1iaI)**")
|
55 |
+
|
56 |
with gr.Tab("Inferencia"):
|
57 |
model_url = gr.Textbox(placeholder="https://huggingface.co/AIVER-SE/BillieEilish/resolve/main/BillieEilish.zip", label="Url del modelo", show_label=True)
|
58 |
+
with gr.Row():
|
59 |
+
with gr.Column():
|
60 |
+
audio_path = gr.Audio(label="Archivo de audio", show_label=True, type="filepath",)
|
61 |
+
index_rate = gr.Slider(minimum=0, maximum=1, label="Search feature ratio:", value=0.75, interactive=True,)
|
62 |
+
filter_radius1 = gr.Slider(minimum=0, maximum=7, label="Filtro (reducción de asperezas respiración)", value=3, step=1, interactive=True,)
|
63 |
+
with gr.Column():
|
64 |
+
f0_method = gr.Dropdown(choices=["harvest", "pm", "crepe", "crepe-tiny", "mangio-crepe", "mangio-crepe-tiny", "rmvpe"],
|
65 |
+
value="rmvpe",
|
66 |
+
label="Algoritmo", show_label=True)
|
67 |
+
vc_transform0 = gr.Slider(minimum=-12, label="Número de semitonos, subir una octava: 12, bajar una octava: -12", value=0, maximum=12, step=1)
|
68 |
+
protect0 = gr.Slider(
|
69 |
+
minimum=0, maximum=0.5, label="Protejer las consonantes sordas y los sonidos respiratorios. 0.5 para desactivarlo.", value=0.33,
|
70 |
+
step=0.01,
|
71 |
+
interactive=True,
|
72 |
+
)
|
73 |
+
resample_sr1 = gr.Slider(
|
74 |
+
minimum=0,
|
75 |
+
maximum=48000,
|
76 |
+
label="Re-muestreo sobre el audio de salida hasta la frecuencia de muestreo final. 0 para no re-muestrear.",
|
77 |
+
value=0,
|
78 |
+
step=1,
|
79 |
+
interactive=True,
|
80 |
+
)
|
81 |
+
|
82 |
# Salida
|
83 |
with gr.Row():
|
84 |
vc_output1 = gr.Textbox(label="Salida")
|
85 |
vc_output2 = gr.Audio(label="Audio de salida")
|
86 |
|
87 |
btn = gr.Button(value="Convertir")
|
88 |
+
btn.click(infer, inputs=[model_url, f0_method, audio_path, index_rate, vc_transform0, protect0, resample_sr1, filter_radius1], outputs=[vc_output1, vc_output2])
|
89 |
|
90 |
with gr.TabItem("TTS"):
|
91 |
with gr.Row():
|
inference.py
CHANGED
@@ -18,7 +18,7 @@ class Inference:
|
|
18 |
feature_index_path="",
|
19 |
f0_file=None,
|
20 |
speaker_id=0,
|
21 |
-
transposition
|
22 |
f0_method="harvest",
|
23 |
crepe_hop_length=160,
|
24 |
harvest_median_filter=3,
|
|
|
18 |
feature_index_path="",
|
19 |
f0_file=None,
|
20 |
speaker_id=0,
|
21 |
+
transposition=0,
|
22 |
f0_method="harvest",
|
23 |
crepe_hop_length=160,
|
24 |
harvest_median_filter=3,
|
models/model.py
CHANGED
@@ -65,19 +65,24 @@ def compress(modelname, files):
|
|
65 |
|
66 |
return file_path
|
67 |
|
68 |
-
def infer(model, f0_method, audio_file):
|
69 |
print("****", audio_file)
|
70 |
inference = Inference(
|
71 |
model_name=model,
|
72 |
f0_method=f0_method,
|
73 |
source_audio_path=audio_file,
|
|
|
|
|
|
|
|
|
|
|
74 |
output_file_name=os.path.join("./audio-outputs", os.path.basename(audio_file))
|
75 |
)
|
76 |
output = inference.run()
|
77 |
if 'success' in output and output['success']:
|
78 |
return output, output['file']
|
79 |
else:
|
80 |
-
return
|
81 |
|
82 |
|
83 |
def post_model(name, model_url, version, creator):
|
|
|
65 |
|
66 |
return file_path
|
67 |
|
68 |
+
def infer(model, f0_method, audio_file, index_rate, vc_transform0, protect0, resample_sr1, filter_radius1):
|
69 |
print("****", audio_file)
|
70 |
inference = Inference(
|
71 |
model_name=model,
|
72 |
f0_method=f0_method,
|
73 |
source_audio_path=audio_file,
|
74 |
+
feature_ratio=index_rate,
|
75 |
+
transposition=vc_transform0,
|
76 |
+
protection_amnt=protect0,
|
77 |
+
resample=resample_sr1,
|
78 |
+
harvest_median_filter=filter_radius1,
|
79 |
output_file_name=os.path.join("./audio-outputs", os.path.basename(audio_file))
|
80 |
)
|
81 |
output = inference.run()
|
82 |
if 'success' in output and output['success']:
|
83 |
return output, output['file']
|
84 |
else:
|
85 |
+
return "Failed", None
|
86 |
|
87 |
|
88 |
def post_model(name, model_url, version, creator):
|