Sandiago21 commited on
Commit
f175fd6
·
verified ·
1 Parent(s): c9e6387

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -20
app.py CHANGED
@@ -88,23 +88,4 @@ agent = CodeAgent(
88
  )
89
 
90
 
91
- # -------------------------
92
- # Launch Gradio UI
93
- # -------------------------
94
- # Custom wrapper to automatically unwrap BytesIO images from FinalAnswerStep
95
- def gradio_output_wrapper(agent_output):
96
- """
97
- Checks if agent_output.final_answer is a BytesIO image and returns it directly
98
- for Gradio to display.
99
- """
100
- try:
101
- # If agent_output has final_answer attribute (FinalAnswerStep)
102
- buffer = getattr(agent_output, "final_answer", None)
103
- if isinstance(buffer, BytesIO):
104
- buffer.seek(0)
105
- return buffer # Gradio can render BytesIO as an image
106
- return agent_output # fallback for text or other outputs
107
- except Exception:
108
- return agent_output
109
-
110
- GradioUI(agent, output_wrapper=gradio_output_wrapper).launch()
 
88
  )
89
 
90
 
91
+ GradioUI(agent).launch()