Spaces:
Sleeping
Sleeping
Update tools/final_answer.py
Browse files- tools/final_answer.py +3 -0
tools/final_answer.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
from typing import Any, Optional
|
2 |
from smolagents.tools import Tool
|
|
|
3 |
|
4 |
class FinalAnswerTool(Tool):
|
5 |
name = "final_answer"
|
@@ -8,6 +9,8 @@ class FinalAnswerTool(Tool):
|
|
8 |
output_type = "any"
|
9 |
|
10 |
def forward(self, answer: Any) -> Any:
|
|
|
|
|
11 |
return answer
|
12 |
|
13 |
def __init__(self, *args, **kwargs):
|
|
|
1 |
from typing import Any, Optional
|
2 |
from smolagents.tools import Tool
|
3 |
+
from PIL import Image
|
4 |
|
5 |
class FinalAnswerTool(Tool):
|
6 |
name = "final_answer"
|
|
|
9 |
output_type = "any"
|
10 |
|
11 |
def forward(self, answer: Any) -> Any:
|
12 |
+
if isinstance(answer, Image.Image):
|
13 |
+
answer.show()
|
14 |
return answer
|
15 |
|
16 |
def __init__(self, *args, **kwargs):
|