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 SimpleTool
|
| 3 |
+
|
| 4 |
+
tool = SimpleTool()
|
| 5 |
+
|
| 6 |
+
launch_gradio_demo(tool)
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
smolagents
|
tool.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from smolagents import Tool
|
| 2 |
+
from typing import Any, Optional
|
| 3 |
+
|
| 4 |
+
class SimpleTool(Tool):
|
| 5 |
+
name = "valid_tool_function"
|
| 6 |
+
description = "A valid tool function."
|
| 7 |
+
inputs = {"input":{"type":"string","description":"Input string."}}
|
| 8 |
+
output_type = "string"
|
| 9 |
+
|
| 10 |
+
def forward(self, input: str) -> str:
|
| 11 |
+
"""A valid tool function.
|
| 12 |
+
Args:
|
| 13 |
+
input (str): Input string.
|
| 14 |
+
"""
|
| 15 |
+
return input.upper()
|