Spaces:
Build error
Build error
Upload tool
Browse files- app.py +6 -0
- requirements.txt +1 -0
- tool.py +15 -0
app.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from smolagents import launch_gradio_demo
|
| 2 |
+
from tool import UserInputTool
|
| 3 |
+
|
| 4 |
+
tool = UserInputTool()
|
| 5 |
+
|
| 6 |
+
launch_gradio_demo(tool)
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
smolagents
|
tool.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, Optional
|
| 2 |
+
from smolagents.tools import Tool
|
| 3 |
+
|
| 4 |
+
class UserInputTool(Tool):
|
| 5 |
+
name = "user_input"
|
| 6 |
+
description = "Asks for user's input on a specific question"
|
| 7 |
+
inputs = {'question': {'type': 'string', 'description': 'The question to ask the user'}}
|
| 8 |
+
output_type = "string"
|
| 9 |
+
|
| 10 |
+
def forward(self, question):
|
| 11 |
+
user_input = input(f"{question} => Type your answer here:")
|
| 12 |
+
return user_input
|
| 13 |
+
|
| 14 |
+
def __init__(self, *args, **kwargs):
|
| 15 |
+
self.is_initialized = False
|