prithivMLmods commited on
Commit
484539f
·
verified ·
1 Parent(s): 3d3f6ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -159,11 +159,13 @@ def generate(
159
 
160
  final_response = "".join(outputs)
161
 
 
 
 
162
  if is_tts and voice:
163
  output_file = asyncio.run(text_to_speech(final_response, voice))
164
- yield gr.Audio(output_file, autoplay=True) # Return audio response as a separate component
165
- else:
166
- yield final_response # Return text response
167
 
168
  demo = gr.ChatInterface(
169
  fn=generate,
 
159
 
160
  final_response = "".join(outputs)
161
 
162
+ # Yield text response first
163
+ yield final_response
164
+
165
  if is_tts and voice:
166
  output_file = asyncio.run(text_to_speech(final_response, voice))
167
+ # Return playable audio separately
168
+ yield gr.Audio(output_file, autoplay=True)
 
169
 
170
  demo = gr.ChatInterface(
171
  fn=generate,