Spaces:
Sleeping
Sleeping
uru commited on
Commit ·
38e3dc1
1
Parent(s): 84bb707
Final commit v1-first-agent
Browse files- tools/final_answer.py +2 -2
tools/final_answer.py
CHANGED
|
@@ -15,7 +15,7 @@ class FinalAnswerTool(Tool):
|
|
| 15 |
output_type = "any"
|
| 16 |
|
| 17 |
def __init__(self, *args, **kwargs):
|
| 18 |
-
super().__init__(*args, **kwargs) #
|
| 19 |
from pathlib import Path
|
| 20 |
self.output_dir = Path.cwd() / "outputs" / "final_answers"
|
| 21 |
self.output_dir.mkdir(parents=True, exist_ok=True)
|
|
@@ -25,7 +25,7 @@ class FinalAnswerTool(Tool):
|
|
| 25 |
return answer
|
| 26 |
|
| 27 |
try:
|
| 28 |
-
from PIL import Image # pillow
|
| 29 |
if isinstance(answer, Image.Image):
|
| 30 |
filename = f"{uuid.uuid4().hex}.png"
|
| 31 |
path = os.path.join(self.output_dir, filename)
|
|
|
|
| 15 |
output_type = "any"
|
| 16 |
|
| 17 |
def __init__(self, *args, **kwargs):
|
| 18 |
+
super().__init__(*args, **kwargs) # IMPORTANT
|
| 19 |
from pathlib import Path
|
| 20 |
self.output_dir = Path.cwd() / "outputs" / "final_answers"
|
| 21 |
self.output_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
| 25 |
return answer
|
| 26 |
|
| 27 |
try:
|
| 28 |
+
from PIL import Image # pillow is usually already there due to text-to-image
|
| 29 |
if isinstance(answer, Image.Image):
|
| 30 |
filename = f"{uuid.uuid4().hex}.png"
|
| 31 |
path = os.path.join(self.output_dir, filename)
|