Spaces:
Running
Running
Update Gradio_UI.py
Browse files- Gradio_UI.py +9 -4
Gradio_UI.py
CHANGED
@@ -167,10 +167,15 @@ def stream_to_gradio(
|
|
167 |
content={"path": final_answer.to_string(), "mime_type": "image/png"},
|
168 |
)
|
169 |
elif isinstance(final_answer, AgentAudio):
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
|
|
|
|
|
|
|
|
|
|
174 |
else:
|
175 |
yield gr.ChatMessage(role="assistant", content=f"**Final answer:** {str(final_answer)}")
|
176 |
|
|
|
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 |
|