Upload tool
Browse files- app.py +5 -0
- requirements.txt +1 -0
- tool.py +14 -0
app.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from smolagents import launch_gradio_demo
|
| 2 |
+
from tool import CustomTool
|
| 3 |
+
|
| 4 |
+
tool = CustomTool()
|
| 5 |
+
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 CustomTool(Tool):
|
| 5 |
+
name = "custom_tool"
|
| 6 |
+
description = "A custom test tool"
|
| 7 |
+
inputs = {'input_text': {'type': 'string', 'description': 'Some input text'}}
|
| 8 |
+
output_type = "string"
|
| 9 |
+
|
| 10 |
+
def forward(self, input_text: str) -> str:
|
| 11 |
+
return f"Processed: {input_text}"
|
| 12 |
+
|
| 13 |
+
def __init__(self, *args, **kwargs):
|
| 14 |
+
self.is_initialized = False
|