clementmandron commited on
Commit
e2b3997
·
verified ·
1 Parent(s): 8c5c24b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -6,6 +6,18 @@ import yaml
6
  from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
 
6
  from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
9
+ _orig_handle = Gradio_UI.handle_agent_output_types
10
+
11
+ def _patched_handle(step):
12
+ # If step is a FinalAnswerStep, extract the inner .final_answer
13
+ if step.__class__.__name__ == 'FinalAnswerStep':
14
+ return step.final_answer
15
+ # otherwise, call the original
16
+ return _orig_handle(step)
17
+
18
+ Gradio_UI.handle_agent_output_types = _patched_handle
19
+
20
+
21
 
22
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
23
  @tool