Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,13 +2,17 @@ import gradio as gr
|
|
2 |
import os, shutil
|
3 |
import subprocess
|
4 |
|
|
|
|
|
|
|
|
|
5 |
def convert(audio_picker,model_picker):
|
6 |
command = [
|
7 |
"python",
|
8 |
"tools/infer_cli.py",
|
9 |
"--f0up_key", "0",
|
10 |
"--input_path", f"audios/{audio_picker}",
|
11 |
-
"--index_path", "",
|
12 |
"--f0method", "rmvpe",
|
13 |
"--opt_path", "cli_output.wav",
|
14 |
"--model_name", f"{model_picker}",
|
@@ -115,7 +119,10 @@ def upload_file(file):
|
|
115 |
|
116 |
def refresh():
|
117 |
return {"choices":show_available('audios'),"__type__": "update"},{"choices":show_available('assets/weights'),"__type__": "update"}
|
118 |
-
|
|
|
|
|
|
|
119 |
with gr.Blocks() as app:
|
120 |
with gr.Row():
|
121 |
with gr.Column():
|
@@ -143,6 +150,8 @@ with gr.Blocks() as app:
|
|
143 |
audio_refresher.click(fn=refresh,inputs=[],outputs=[audio_picker,model_picker])
|
144 |
convert_button = gr.Button("Convert")
|
145 |
convert_button.click(convert, inputs=[audio_picker,model_picker])
|
146 |
-
|
147 |
-
|
148 |
-
|
|
|
|
|
|
2 |
import os, shutil
|
3 |
import subprocess
|
4 |
|
5 |
+
os.environ["rmvpe_root"] = "assets/rmvpe"
|
6 |
+
os.environ['index_root']="logs"
|
7 |
+
os.environ['weight_root']="assets/weights"
|
8 |
+
|
9 |
def convert(audio_picker,model_picker):
|
10 |
command = [
|
11 |
"python",
|
12 |
"tools/infer_cli.py",
|
13 |
"--f0up_key", "0",
|
14 |
"--input_path", f"audios/{audio_picker}",
|
15 |
+
"--index_path", f"logs/{model_picker}/*.index",
|
16 |
"--f0method", "rmvpe",
|
17 |
"--opt_path", "cli_output.wav",
|
18 |
"--model_name", f"{model_picker}",
|
|
|
119 |
|
120 |
def refresh():
|
121 |
return {"choices":show_available('audios'),"__type__": "update"},{"choices":show_available('assets/weights'),"__type__": "update"}
|
122 |
+
|
123 |
+
def update_audio_player(choice):
|
124 |
+
return os.path.join("audios",choice)
|
125 |
+
|
126 |
with gr.Blocks() as app:
|
127 |
with gr.Row():
|
128 |
with gr.Column():
|
|
|
150 |
audio_refresher.click(fn=refresh,inputs=[],outputs=[audio_picker,model_picker])
|
151 |
convert_button = gr.Button("Convert")
|
152 |
convert_button.click(convert, inputs=[audio_picker,model_picker])
|
153 |
+
with gr.Row():
|
154 |
+
audio_player = gr.Audio()
|
155 |
+
audio_picker.change(fn=update_audio_player, inputs=[audio_picker],outputs=[audio_player])
|
156 |
+
|
157 |
+
app.queue().launch()
|