inank commited on
Commit
536a363
·
verified ·
1 Parent(s): 8c5c24b

Extract the generated images so they get displayed in UI

Browse files
Files changed (1) hide show
  1. Gradio_UI.py +6 -1
Gradio_UI.py CHANGED
@@ -154,6 +154,11 @@ def stream_to_gradio(
154
  yield message
155
 
156
  final_answer = step_log # Last log is the run's final_answer
 
 
 
 
 
157
  final_answer = handle_agent_output_types(final_answer)
158
 
159
  if isinstance(final_answer, AgentText):
@@ -293,4 +298,4 @@ class GradioUI:
293
  demo.launch(debug=True, share=True, **kwargs)
294
 
295
 
296
- __all__ = ["stream_to_gradio", "GradioUI"]
 
154
  yield message
155
 
156
  final_answer = step_log # Last log is the run's final_answer
157
+
158
+ # Extract the actual answer from FinalAnswerStep if needed
159
+ if hasattr(final_answer, "final_answer"):
160
+ final_answer = final_answer.final_answer
161
+
162
  final_answer = handle_agent_output_types(final_answer)
163
 
164
  if isinstance(final_answer, AgentText):
 
298
  demo.launch(debug=True, share=True, **kwargs)
299
 
300
 
301
+ __all__ = ["stream_to_gradio", "GradioUI"]