SefyanKehail
commited on
Commit
·
f68e440
1
Parent(s):
ef705d3
added progress instead of spinner
Browse files
app.py
CHANGED
|
@@ -79,24 +79,45 @@ def stop_recording_info(audio, info):
|
|
| 79 |
return gr.update(value="", visible=False)
|
| 80 |
|
| 81 |
# Gradio interface
|
| 82 |
-
|
| 83 |
-
gr.
|
| 84 |
-
|
|
|
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
|
| 92 |
-
|
| 93 |
-
|
| 94 |
|
| 95 |
|
| 96 |
-
|
| 97 |
|
|
|
|
| 98 |
|
| 99 |
-
|
| 100 |
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
|
|
|
| 79 |
return gr.update(value="", visible=False)
|
| 80 |
|
| 81 |
# Gradio interface
|
| 82 |
+
def gui():
|
| 83 |
+
with gr.Blocks() as interface:
|
| 84 |
+
gr.Markdown("# Soft Speech Units for Improved Voice Conversion")
|
| 85 |
+
gr.Markdown("Upload an audio file to convert it to the target speaker's voice using soft speech units. Or use your microphone.")
|
| 86 |
|
| 87 |
+
with gr.Row():
|
| 88 |
+
with gr.Column():
|
| 89 |
+
audio_input = gr.Audio(type="filepath", label="Upload Audio", sources=["microphone", "upload"])
|
| 90 |
+
convert_button = gr.Button("Convert Speech", interactive=False)
|
| 91 |
+
info = gr.Markdown("", visible=False)
|
| 92 |
|
| 93 |
+
with gr.Column():
|
| 94 |
+
converted_audio = gr.Audio(type="numpy", label="Converted Speech")
|
| 95 |
|
| 96 |
|
| 97 |
+
audio_input.stop_recording(stop_recording_info, inputs=[audio_input, info], outputs=[info])
|
| 98 |
|
| 99 |
+
audio_input.change(enable_convert_button, inputs=[audio_input], outputs=[convert_button, info])
|
| 100 |
|
| 101 |
+
convert_button.click(convert_speech, inputs=[audio_input], outputs=[converted_audio])
|
| 102 |
|
| 103 |
+
audio_input.clear(clear_components, inputs=None, outputs=[audio_input, converted_audio])
|
| 104 |
+
|
| 105 |
+
# audio_input.change(enable_convert_button, inputs=[audio_input], outputs=[convert_button, info])
|
| 106 |
+
|
| 107 |
+
return interface
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
if __name__ == "__main__":
|
| 111 |
+
|
| 112 |
+
app = gui()
|
| 113 |
+
|
| 114 |
+
app.queue(default_concurrency_limit=40)
|
| 115 |
+
|
| 116 |
+
app.launch(
|
| 117 |
+
max_threads=40,
|
| 118 |
+
share=False,
|
| 119 |
+
show_error=True,
|
| 120 |
+
quiet=False,
|
| 121 |
+
debug=False,
|
| 122 |
+
)
|
| 123 |
|