Spaces:
Sleeping
Sleeping
Update tools/final_answer.py
Browse files- tools/final_answer.py +6 -2
tools/final_answer.py
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from typing import Any
|
| 2 |
-
from smolagents.tools import Tool
|
| 3 |
|
| 4 |
class FinalAnswerTool(Tool):
|
| 5 |
name = "final_answer"
|
|
@@ -12,7 +16,7 @@ class FinalAnswerTool(Tool):
|
|
| 12 |
|
| 13 |
def forward(self, answer: Any = "", image: Any = None) -> str:
|
| 14 |
# Handle AgentImage rendering
|
| 15 |
-
if isinstance(image
|
| 16 |
try:
|
| 17 |
image_html = image.display() # or image.to_html()
|
| 18 |
except:
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
|
| 5 |
from typing import Any
|
| 6 |
+
from smolagents.tools import Tool
|
| 7 |
|
| 8 |
class FinalAnswerTool(Tool):
|
| 9 |
name = "final_answer"
|
|
|
|
| 16 |
|
| 17 |
def forward(self, answer: Any = "", image: Any = None) -> str:
|
| 18 |
# Handle AgentImage rendering
|
| 19 |
+
if isinstance(image):
|
| 20 |
try:
|
| 21 |
image_html = image.display() # or image.to_html()
|
| 22 |
except:
|