Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,14 +9,42 @@ from Gradio_UI import GradioUI
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
-
def
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
"""
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def basic_calculator(a: int, b: int, operation: str) -> int:
|
| 13 |
+
"""
|
| 14 |
+
A basic arithmetic calculator.
|
| 15 |
+
Args:
|
| 16 |
+
a: The first integer.
|
| 17 |
+
b: The second integer.
|
| 18 |
+
operation: The operation to perform ('add', 'multiply', 'divide', or 'subtract').
|
| 19 |
+
"""
|
| 20 |
+
if operation == "add":
|
| 21 |
+
return a + b
|
| 22 |
+
elif operation == "multiply":
|
| 23 |
+
return a * b
|
| 24 |
+
elif operation == "divide":
|
| 25 |
+
return a // b if b != 0 else "Error: Division by zero"
|
| 26 |
+
elif operation == "subtract":
|
| 27 |
+
return a - b
|
| 28 |
+
else:
|
| 29 |
+
return "Unknown operation"
|
| 30 |
+
|
| 31 |
+
@tool
|
| 32 |
+
def get_weather(place: str, time: int) -> str:
|
| 33 |
+
"""
|
| 34 |
+
A Wether tool, that returns the weather conditon of a place, at a given time.
|
| 35 |
Args:
|
| 36 |
+
place: The name of the place or location
|
| 37 |
+
time: The hour of the day(0-23)
|
| 38 |
+
|
| 39 |
+
You take the Place, and the time of the day, and return the weather.
|
| 40 |
"""
|
| 41 |
+
|
| 42 |
+
# Using an f-string is the best way to combine variables and text in Python
|
| 43 |
+
return f"The weather condition for {place} at {time}:00 is sunny with a light breeze."
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
@tool
|
| 47 |
+
|
| 48 |
|
| 49 |
@tool
|
| 50 |
def get_current_time_in_timezone(timezone: str) -> str:
|