Spaces:
Sleeping
Sleeping
DEBUG output
Browse files- Gradio_UI.py +6 -6
Gradio_UI.py
CHANGED
|
@@ -22,9 +22,8 @@ from datetime import datetime
|
|
| 22 |
|
| 23 |
from smolagents.agent_types import AgentAudio, AgentImage, AgentText, handle_agent_output_types
|
| 24 |
from smolagents.agents import ActionStep, MultiStepAgent
|
| 25 |
-
from smolagents.memory import MemoryStep
|
| 26 |
from smolagents.utils import _is_package_available
|
| 27 |
-
from smolagents.agents import FinalAnswerStep
|
| 28 |
|
| 29 |
def debug_print(x):
|
| 30 |
print("DEBUG_FROM_GRADIO:", x)
|
|
@@ -172,13 +171,14 @@ def stream_to_gradio(
|
|
| 172 |
yield message, None
|
| 173 |
|
| 174 |
# Dernier log = final answer
|
| 175 |
-
final_output = step_log
|
| 176 |
print("DEBUG_FINAL_TYPE:", type(final_output), dir(final_output))
|
| 177 |
-
|
|
|
|
| 178 |
if isinstance(final_output, FinalAnswerStep):
|
| 179 |
-
final_output = final_output.
|
| 180 |
|
| 181 |
-
#
|
| 182 |
final_answer = handle_agent_output_types(final_output)
|
| 183 |
|
| 184 |
# Valeurs par défaut
|
|
|
|
| 22 |
|
| 23 |
from smolagents.agent_types import AgentAudio, AgentImage, AgentText, handle_agent_output_types
|
| 24 |
from smolagents.agents import ActionStep, MultiStepAgent
|
| 25 |
+
from smolagents.memory import MemoryStep, FinalAnswerStep
|
| 26 |
from smolagents.utils import _is_package_available
|
|
|
|
| 27 |
|
| 28 |
def debug_print(x):
|
| 29 |
print("DEBUG_FROM_GRADIO:", x)
|
|
|
|
| 171 |
yield message, None
|
| 172 |
|
| 173 |
# Dernier log = final answer
|
| 174 |
+
final_output = step_log
|
| 175 |
print("DEBUG_FINAL_TYPE:", type(final_output), dir(final_output))
|
| 176 |
+
|
| 177 |
+
# Si c'est un FinalAnswerStep, on récupère le champ final_answer
|
| 178 |
if isinstance(final_output, FinalAnswerStep):
|
| 179 |
+
final_output = final_output.final_answer
|
| 180 |
|
| 181 |
+
# Normalisation en AgentText / AgentImage / AgentAudio
|
| 182 |
final_answer = handle_agent_output_types(final_output)
|
| 183 |
|
| 184 |
# Valeurs par défaut
|