Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -129,15 +129,15 @@ def create_demo():
|
|
129 |
def process_audio(audio, volume):
|
130 |
logging.info(f"Received audio: {audio}")
|
131 |
if audio is None:
|
132 |
-
return "No audio detected. Please try recording again.", None
|
133 |
response, audio_path = transcribe_and_chat(audio)
|
134 |
# Adjust volume for the response audio
|
135 |
adjusted_audio_path = asyncio.run(text_to_speech_stream(response, volume))
|
136 |
logging.info(f"Response: {response}, Audio path: {adjusted_audio_path}")
|
137 |
-
return response, adjusted_audio_path
|
138 |
|
139 |
-
audio_input.change(process_audio, inputs=[audio_input, voice_volume], outputs=[chat_output, audio_output
|
140 |
-
clear_button.click(lambda: (None, None
|
141 |
|
142 |
# JavaScript to handle autoplay and automatic submission
|
143 |
demo.load(None, js="""
|
|
|
129 |
def process_audio(audio, volume):
|
130 |
logging.info(f"Received audio: {audio}")
|
131 |
if audio is None:
|
132 |
+
return "No audio detected. Please try recording again.", None
|
133 |
response, audio_path = transcribe_and_chat(audio)
|
134 |
# Adjust volume for the response audio
|
135 |
adjusted_audio_path = asyncio.run(text_to_speech_stream(response, volume))
|
136 |
logging.info(f"Response: {response}, Audio path: {adjusted_audio_path}")
|
137 |
+
return response, adjusted_audio_path
|
138 |
|
139 |
+
audio_input.change(process_audio, inputs=[audio_input, voice_volume], outputs=[chat_output, audio_output])
|
140 |
+
clear_button.click(lambda: (None, None), None, [chat_output, audio_output])
|
141 |
|
142 |
# JavaScript to handle autoplay and automatic submission
|
143 |
demo.load(None, js="""
|