uasername commited on
Commit
3fc8296
·
verified ·
1 Parent(s): 6da24fc

Update Gradio_UI.py

Browse files
Files changed (1) hide show
  1. Gradio_UI.py +4 -9
Gradio_UI.py CHANGED
@@ -167,15 +167,10 @@ def stream_to_gradio(
167
  content={"path": final_answer.to_string(), "mime_type": "image/png"},
168
  )
169
  elif isinstance(final_answer, AgentAudio):
170
- # Get the file path from the AgentAudio object.
171
- # If the TTS tool saved the file in the "static" folder, ensure the path points there.
172
- audio_file = final_answer.to_string()
173
- if not os.path.isabs(audio_file): # if it's a relative path
174
- audio_file = os.path.join("static", audio_file)
175
- yield gr.ChatMessage(
176
- role="assistant",
177
- content={"path": audio_file, "mime_type": "audio/wav"},
178
- )
179
  else:
180
  yield gr.ChatMessage(role="assistant", content=f"**Final answer:** {str(final_answer)}")
181
 
 
167
  content={"path": final_answer.to_string(), "mime_type": "image/png"},
168
  )
169
  elif isinstance(final_answer, AgentAudio):
170
+ yield gr.ChatMessage(
171
+ role="assistant",
172
+ content={"path": final_answer.to_string(), "mime_type": "audio/wav"},
173
+ )
 
 
 
 
 
174
  else:
175
  yield gr.ChatMessage(role="assistant", content=f"**Final answer:** {str(final_answer)}")
176