SefyanKehail
commited on
Commit
·
d099b64
1
Parent(s):
06e03cb
added progress instead of spinner
Browse files- app.py +15 -14
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -65,16 +65,18 @@ def convert_speech(filename, progress=gr.Progress()):
|
|
| 65 |
|
| 66 |
"""Convert to the target speaker:"""
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
|
| 73 |
-
|
| 74 |
-
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
| 78 |
|
| 79 |
# Gradio interface
|
| 80 |
def gui():
|
|
@@ -84,7 +86,7 @@ def gui():
|
|
| 84 |
|
| 85 |
with gr.Row():
|
| 86 |
with gr.Column():
|
| 87 |
-
audio_input = gr.Audio(sources=["microphone"], type="filepath", label="Upload Audio"
|
| 88 |
convert_button = gr.Button("Convert Speech", interactive=True)
|
| 89 |
info = gr.Markdown("", visible=False)
|
| 90 |
|
|
@@ -94,11 +96,10 @@ def gui():
|
|
| 94 |
|
| 95 |
# audio_input.pause(stop_recording_info, inputs=[audio_input, info], outputs=[info])
|
| 96 |
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
gr.Warning("Please upload an audio, or use the built-in microphone")
|
| 102 |
# audio_input.clear(clear_components, inputs=None, outputs=[audio_input, converted_audio])
|
| 103 |
|
| 104 |
# audio_input.change(enable_convert_button, inputs=[audio_input], outputs=[convert_button, info])
|
|
|
|
| 65 |
|
| 66 |
"""Convert to the target speaker:"""
|
| 67 |
|
| 68 |
+
def enable_convert_button(audio):
|
| 69 |
+
if audio is not None:
|
| 70 |
+
return gr.update(interactive=True), gr.update(value="", visible=False)
|
| 71 |
+
return gr.update(interactive=False), None
|
| 72 |
|
| 73 |
+
def clear_components():
|
| 74 |
+
return None, None
|
| 75 |
|
| 76 |
+
def stop_recording_info(audio, info):
|
| 77 |
+
if audio is None:
|
| 78 |
+
return gr.update(value="### <i style='color:yellow'>Processing audio, please wait ...</i>", visible=True)
|
| 79 |
+
return gr.update(value="", visible=False)
|
| 80 |
|
| 81 |
# Gradio interface
|
| 82 |
def gui():
|
|
|
|
| 86 |
|
| 87 |
with gr.Row():
|
| 88 |
with gr.Column():
|
| 89 |
+
audio_input = gr.Audio(sources=["upload", "microphone"], type="filepath", label="Upload Audio")
|
| 90 |
convert_button = gr.Button("Convert Speech", interactive=True)
|
| 91 |
info = gr.Markdown("", visible=False)
|
| 92 |
|
|
|
|
| 96 |
|
| 97 |
# audio_input.pause(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])
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
gradio
|
| 2 |
torch
|
| 3 |
torchaudio
|
| 4 |
requests
|
|
|
|
| 1 |
+
https://gradio-builds.s3.amazonaws.com/b35e3ae839d208520180299077f4ce57bb96fca4/gradio-4.25.0-py3-none-any.whl
|
| 2 |
torch
|
| 3 |
torchaudio
|
| 4 |
requests
|