Spaces:
Runtime error
Runtime error
Upload tool
Browse files- app.py +6 -0
- requirements.txt +1 -0
- tool.py +14 -0
app.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from smolagents import launch_gradio_demo
|
| 2 |
+
from tool import FinalAnswerTool
|
| 3 |
+
|
| 4 |
+
tool = FinalAnswerTool()
|
| 5 |
+
|
| 6 |
+
launch_gradio_demo(tool)
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
smolagents
|
tool.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, Optional
|
| 2 |
+
from smolagents.tools import Tool
|
| 3 |
+
|
| 4 |
+
class FinalAnswerTool(Tool):
|
| 5 |
+
name = "final_answer"
|
| 6 |
+
description = "This is a tool sends the final answer to the given problem, towards the user. This tool does not format the answer, it just sends it as is."
|
| 7 |
+
inputs = {'answer': {'type': 'any', 'description': 'The well formated, short, and conversational final answer to the user`s problem or request.'}}
|
| 8 |
+
output_type = "any"
|
| 9 |
+
|
| 10 |
+
def forward(self, answer: Any) -> Any:
|
| 11 |
+
return answer
|
| 12 |
+
|
| 13 |
+
def __init__(self, *args, **kwargs):
|
| 14 |
+
self.is_initialized = False
|