Spaces:
Running
Running
inference tab
Browse filesso i edit some in ui, the result look like this:
![result.png](https://cdn-uploads.huggingface.co/production/uploads/65e2f1cb4dbf9514fb475b48/owKfOvngCz8wG5_sosNCR.png)
app.py
CHANGED
@@ -52,6 +52,7 @@ def load_model(model_picker,index_picker):
|
|
52 |
def convert(audio_picker,model_picker,index_picker,index_rate,pitch,method):
|
53 |
warn("Your audio is being converted. Please wait.")
|
54 |
now = datetime.now().strftime("%d%m%Y%H%M%S")
|
|
|
55 |
index_files = glob.glob(f"logs/{index_picker}/*.index")
|
56 |
if index_files:
|
57 |
print(f"Found index: {index_files[0]}")
|
@@ -67,7 +68,7 @@ def convert(audio_picker,model_picker,index_picker,index_rate,pitch,method):
|
|
67 |
"--input_path", f"audios/{audio_picker}",
|
68 |
"--index_path", index_files[0],
|
69 |
"--f0method", method,
|
70 |
-
"--opt_path",
|
71 |
"--model_name", f"{model_picker}",
|
72 |
"--index_rate", str(float(index_rate)),
|
73 |
"--device", device,
|
@@ -270,10 +271,32 @@ with gr.Blocks() as app:
|
|
270 |
with gr.Row():
|
271 |
with gr.Column():
|
272 |
with gr.Tabs():
|
273 |
-
with gr.TabItem("1.
|
274 |
model_picker = gr.Dropdown(label="Model: ",choices=show_available('assets/weights','.pth'),value=show_available('assets/weights','.pth')[0],interactive=True,allow_custom_value=True)
|
275 |
index_picker = gr.Dropdown(label="Index:",interactive=True,choices=show_available('logs'),value=show_available('logs')[0],allow_custom_value=True)
|
276 |
model_picker.change(fn=load_model,inputs=[model_picker,index_picker],outputs=[index_picker])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
with gr.TabItem("(Or download a model here)"):
|
278 |
with gr.Row():
|
279 |
url = gr.Textbox(label="Paste the URL here:",value="",placeholder="(i.e. https://huggingface.co/repo/model/resolve/main/model.zip)")
|
@@ -287,26 +310,9 @@ with gr.Blocks() as app:
|
|
287 |
selected_import = gr.Dropdown(choices=list(models.keys()),label="OR Search Models (Quality UNKNOWN)",scale=5)
|
288 |
import_model = gr.Button("Download")
|
289 |
import_model.click(fn=import_from_name,inputs=[selected_import],outputs=[selected_import,model_picker])
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
method = gr.Dropdown(label="Method:",choices=["rmvpe","pm"],value="rmvpe")
|
294 |
-
|
295 |
-
with gr.Row():
|
296 |
-
with gr.Tabs():
|
297 |
-
with gr.TabItem("2.Choose an audio file:"):
|
298 |
-
recorder = gr.Microphone(label="Record audio here...",type='filepath')
|
299 |
-
audio_picker = gr.Dropdown(label="",choices=show_available('audios'),value='',interactive=True)
|
300 |
-
try:
|
301 |
-
recorder.stop_recording(upload_file, inputs=[recorder],outputs=[audio_picker])
|
302 |
-
except:
|
303 |
-
recorder.upload(upload_file, inputs=[recorder],outputs=[audio_picker])
|
304 |
-
with gr.TabItem("(Or upload a new file here)"):
|
305 |
-
try:
|
306 |
-
dropbox = gr.File(label="Drop an audio here.",file_types=['.wav', '.mp3', '.ogg', '.flac', '.aac'], type="filepath")
|
307 |
-
except:#Version Compatibiliy
|
308 |
-
dropbox = gr.File(label="Drop an audio here.",file_types=['.wav', '.mp3', '.ogg', '.flac', '.aac'], type="file")
|
309 |
-
dropbox.upload(fn=upload_file, inputs=[dropbox],outputs=[audio_picker])
|
310 |
audio_refresher = gr.Button("Refresh")
|
311 |
audio_refresher.click(fn=refresh,inputs=[],outputs=[audio_picker,model_picker,index_picker])
|
312 |
convert_button = gr.Button("Convert")
|
@@ -321,4 +327,4 @@ with gr.Blocks() as app:
|
|
321 |
stereo_player = gr.Audio(interactive=False)
|
322 |
audio_player.change(fn=stereo, inputs=[audio_player],outputs=[stereo_player])
|
323 |
|
324 |
-
app.queue(max_size=20).launch(debug=True,allowed_paths=["kofi_button.png"])
|
|
|
52 |
def convert(audio_picker,model_picker,index_picker,index_rate,pitch,method):
|
53 |
warn("Your audio is being converted. Please wait.")
|
54 |
now = datetime.now().strftime("%d%m%Y%H%M%S")
|
55 |
+
save_as = f"audios/cli_output_{now}.wav"
|
56 |
index_files = glob.glob(f"logs/{index_picker}/*.index")
|
57 |
if index_files:
|
58 |
print(f"Found index: {index_files[0]}")
|
|
|
68 |
"--input_path", f"audios/{audio_picker}",
|
69 |
"--index_path", index_files[0],
|
70 |
"--f0method", method,
|
71 |
+
"--opt_path", save_as,
|
72 |
"--model_name", f"{model_picker}",
|
73 |
"--index_rate", str(float(index_rate)),
|
74 |
"--device", device,
|
|
|
271 |
with gr.Row():
|
272 |
with gr.Column():
|
273 |
with gr.Tabs():
|
274 |
+
with gr.TabItem("1. Inference:"):
|
275 |
model_picker = gr.Dropdown(label="Model: ",choices=show_available('assets/weights','.pth'),value=show_available('assets/weights','.pth')[0],interactive=True,allow_custom_value=True)
|
276 |
index_picker = gr.Dropdown(label="Index:",interactive=True,choices=show_available('logs'),value=show_available('logs')[0],allow_custom_value=True)
|
277 |
model_picker.change(fn=load_model,inputs=[model_picker,index_picker],outputs=[index_picker])
|
278 |
+
|
279 |
+
with gr.Accordion("Inference Settings", open=False):
|
280 |
+
index_rate = gr.Slider(label='Index Rate: ',minimum=0,maximum=1,value=0.66,step=0.01)
|
281 |
+
pitch = gr.Slider(label='Pitch (-12 lowers it an octave, 0 keeps the original pitch, 12 lifts it an octave): ',minimum =-12, maximum=12, step=1, value=0, interactive=True)
|
282 |
+
method = gr.Dropdown(label="Method:",choices=["rmvpe","pm"],value="rmvpe")
|
283 |
+
|
284 |
+
|
285 |
+
with gr.Column():
|
286 |
+
with gr.Tabs():
|
287 |
+
with gr.TabItem("2.Choose an audio file:"):
|
288 |
+
recorder = gr.Microphone(label="Record audio here...",type='filepath')
|
289 |
+
audio_picker = gr.Dropdown(label="",choices=show_available('audios'),value='',interactive=True)
|
290 |
+
try:
|
291 |
+
recorder.stop_recording(upload_file, inputs=[recorder],outputs=[audio_picker])
|
292 |
+
except:
|
293 |
+
recorder.upload(upload_file, inputs=[recorder],outputs=[audio_picker])
|
294 |
+
with gr.TabItem("(Or upload a new file here)"):
|
295 |
+
try:
|
296 |
+
dropbox = gr.File(label="Drop an audio here.",file_types=['.wav', '.mp3', '.ogg', '.flac', '.aac'], type="filepath")
|
297 |
+
except:#Version Compatibiliy
|
298 |
+
dropbox = gr.File(label="Drop an audio here.",file_types=['.wav', '.mp3', '.ogg', '.flac', '.aac'], type="file")
|
299 |
+
|
300 |
with gr.TabItem("(Or download a model here)"):
|
301 |
with gr.Row():
|
302 |
url = gr.Textbox(label="Paste the URL here:",value="",placeholder="(i.e. https://huggingface.co/repo/model/resolve/main/model.zip)")
|
|
|
310 |
selected_import = gr.Dropdown(choices=list(models.keys()),label="OR Search Models (Quality UNKNOWN)",scale=5)
|
311 |
import_model = gr.Button("Download")
|
312 |
import_model.click(fn=import_from_name,inputs=[selected_import],outputs=[selected_import,model_picker])
|
313 |
+
|
314 |
+
|
315 |
+
dropbox.upload(fn=upload_file, inputs=[dropbox],outputs=[audio_picker])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
audio_refresher = gr.Button("Refresh")
|
317 |
audio_refresher.click(fn=refresh,inputs=[],outputs=[audio_picker,model_picker,index_picker])
|
318 |
convert_button = gr.Button("Convert")
|
|
|
327 |
stereo_player = gr.Audio(interactive=False)
|
328 |
audio_player.change(fn=stereo, inputs=[audio_player],outputs=[stereo_player])
|
329 |
|
330 |
+
app.queue(max_size=20).launch(debug=True,allowed_paths=["kofi_button.png"])
|