ngandugilbert commited on
Commit
5a57989
·
verified ·
1 Parent(s): df2dae8

Upload tool

Browse files
Files changed (3) hide show
  1. app.py +5 -0
  2. requirements.txt +1 -0
  3. tool.py +16 -0
app.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ from smolagents import launch_gradio_demo
2
+ from tool import WeatherTool
3
+
4
+ tool = WeatherTool()
5
+ launch_gradio_demo(tool)
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ smolagents
tool.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Optional
2
+ from smolagents.tools import Tool
3
+
4
+ class WeatherTool(Tool):
5
+ name = "weather_tool"
6
+ description = """
7
+ This is a tool to get weather information about a particular city"""
8
+ inputs = {'city': {'type': 'string', 'description': 'City you wish to find out weather information for.'}}
9
+ output_type = "string"
10
+
11
+ def forward(self, city: str):
12
+
13
+ return f"The current weather in {city} is 25 degrees celsius."
14
+
15
+ def __init__(self, *args, **kwargs):
16
+ self.is_initialized = False