SefyanKehail
commited on
Commit
·
1af470c
1
Parent(s):
15727c0
added progress instead of spinner
Browse files
app.py
CHANGED
|
@@ -73,15 +73,12 @@ def enable_convert_button(audio):
|
|
| 73 |
def clear_components():
|
| 74 |
return None, None
|
| 75 |
|
| 76 |
-
def
|
| 77 |
-
|
| 78 |
|
| 79 |
-
def
|
| 80 |
-
|
| 81 |
-
return gr.update(visible=False)
|
| 82 |
|
| 83 |
-
def upload_audio(audio):
|
| 84 |
-
return audio
|
| 85 |
|
| 86 |
# Gradio interface
|
| 87 |
with gr.Blocks() as interface:
|
|
@@ -92,16 +89,18 @@ with gr.Blocks() as interface:
|
|
| 92 |
with gr.Column():
|
| 93 |
audio_input = gr.Audio(type="filepath", label="Upload Audio", sources=["upload", "microphone"])
|
| 94 |
convert_button = gr.Button("Convert Speech", interactive=False)
|
| 95 |
-
spinner = gr.Markdown("", visible=False) # Spinner
|
| 96 |
|
| 97 |
with gr.Column():
|
| 98 |
converted_audio = gr.Audio(type="numpy", label="Converted Speech")
|
| 99 |
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
audio_input.change(enable_convert_button, inputs=[audio_input], outputs=[convert_button])
|
| 103 |
|
| 104 |
-
audio_input.change(
|
| 105 |
|
| 106 |
convert_button.click(convert_speech, inputs=[audio_input], outputs=[converted_audio])
|
| 107 |
|
|
|
|
| 73 |
def clear_components():
|
| 74 |
return None, None
|
| 75 |
|
| 76 |
+
def show_progress(progress):
|
| 77 |
+
return gr.update(visible=True)
|
| 78 |
|
| 79 |
+
def hide_progress(progress):
|
| 80 |
+
return gr.update(visible=False)
|
|
|
|
| 81 |
|
|
|
|
|
|
|
| 82 |
|
| 83 |
# Gradio interface
|
| 84 |
with gr.Blocks() as interface:
|
|
|
|
| 89 |
with gr.Column():
|
| 90 |
audio_input = gr.Audio(type="filepath", label="Upload Audio", sources=["upload", "microphone"])
|
| 91 |
convert_button = gr.Button("Convert Speech", interactive=False)
|
|
|
|
| 92 |
|
| 93 |
with gr.Column():
|
| 94 |
converted_audio = gr.Audio(type="numpy", label="Converted Speech")
|
| 95 |
|
| 96 |
+
|
| 97 |
+
progress = gr.Progress(visible=False)
|
| 98 |
+
|
| 99 |
+
audio_input.change(show_progress, inputs=[audio_input], outputs=[progress])
|
| 100 |
|
| 101 |
audio_input.change(enable_convert_button, inputs=[audio_input], outputs=[convert_button])
|
| 102 |
|
| 103 |
+
audio_input.change(hide_progress, inputs=[audio_input], outputs=[progress])
|
| 104 |
|
| 105 |
convert_button.click(convert_speech, inputs=[audio_input], outputs=[converted_audio])
|
| 106 |
|