samih-7 commited on
Commit
2701dc9
·
verified ·
1 Parent(s): d60cacf

Update Gradio_UI.py

Browse files
Files changed (1) hide show
  1. Gradio_UI.py +5 -0
Gradio_UI.py CHANGED
@@ -23,6 +23,7 @@ from smolagents.agent_types import AgentAudio, AgentImage, AgentText, handle_age
23
  from smolagents.agents import ActionStep, MultiStepAgent
24
  from smolagents.memory import MemoryStep
25
  from smolagents.utils import _is_package_available
 
26
 
27
 
28
  def pull_messages_from_step(
@@ -154,6 +155,10 @@ 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):
 
23
  from smolagents.agents import ActionStep, MultiStepAgent
24
  from smolagents.memory import MemoryStep
25
  from smolagents.utils import _is_package_available
26
+ from smolagents.agents import FinalAnswerStep
27
 
28
 
29
  def pull_messages_from_step(
 
155
  yield message
156
 
157
  final_answer = step_log # Last log is the run's final_answer
158
+
159
+ if isinstance(final_answer, FinalAnswerStep):
160
+ final_answer = final_answer.final_answer
161
+
162
  final_answer = handle_agent_output_types(final_answer)
163
 
164
  if isinstance(final_answer, AgentText):