Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -247,10 +247,15 @@ def handle_voice_to_voice(audio):
|
|
247 |
logging.error(f"Error in handle_voice_to_voice: {e}")
|
248 |
return "Error processing the audio, please try again.", ""
|
249 |
|
|
|
|
|
|
|
|
|
250 |
# Define the Gradio interface
|
251 |
with gr.Blocks(theme="rawrsor1/Everforest") as demo:
|
252 |
audio_input = gr.Audio(sources=["microphone"], type='numpy', streaming=True, label="Speak to Ask")
|
253 |
submit_voice_btn = gr.Button("Submit Voice")
|
|
|
254 |
transcription_textbox = gr.Textbox(label="Transcription", interactive=False)
|
255 |
audio_output = gr.Audio(label="Response Audio", type="filepath", autoplay=True, interactive=False)
|
256 |
|
@@ -259,10 +264,13 @@ with gr.Blocks(theme="rawrsor1/Everforest") as demo:
|
|
259 |
fn=handle_voice_to_voice,
|
260 |
inputs=audio_input,
|
261 |
outputs=[audio_output, transcription_textbox]
|
262 |
-
)
|
263 |
-
|
264 |
-
|
|
|
|
|
|
|
265 |
)
|
266 |
|
267 |
# Launch the Gradio interface
|
268 |
-
demo.launch(show_error=True, share=True)
|
|
|
247 |
logging.error(f"Error in handle_voice_to_voice: {e}")
|
248 |
return "Error processing the audio, please try again.", ""
|
249 |
|
250 |
+
# Function to clear the transcription state
|
251 |
+
def clear_state():
|
252 |
+
return ""
|
253 |
+
|
254 |
# Define the Gradio interface
|
255 |
with gr.Blocks(theme="rawrsor1/Everforest") as demo:
|
256 |
audio_input = gr.Audio(sources=["microphone"], type='numpy', streaming=True, label="Speak to Ask")
|
257 |
submit_voice_btn = gr.Button("Submit Voice")
|
258 |
+
clear_state_btn = gr.Button("Clear State")
|
259 |
transcription_textbox = gr.Textbox(label="Transcription", interactive=False)
|
260 |
audio_output = gr.Audio(label="Response Audio", type="filepath", autoplay=True, interactive=False)
|
261 |
|
|
|
264 |
fn=handle_voice_to_voice,
|
265 |
inputs=audio_input,
|
266 |
outputs=[audio_output, transcription_textbox]
|
267 |
+
)
|
268 |
+
|
269 |
+
# Interaction for Clear State Button
|
270 |
+
clear_state_btn.click(
|
271 |
+
fn=clear_state,
|
272 |
+
outputs=transcription_textbox
|
273 |
)
|
274 |
|
275 |
# Launch the Gradio interface
|
276 |
+
demo.launch(show_error=True, share=True)
|