albertvillanova HF Staff commited on
Commit
ca00577
·
verified ·
1 Parent(s): cf91ef0

Upload tool

Browse files
Files changed (3) hide show
  1. app.py +5 -0
  2. requirements.txt +1 -0
  3. 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