Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,33 +9,18 @@ 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 calculator(arg1: int, arg2:
|
| 13 |
"""
|
| 14 |
-
Performs
|
| 15 |
|
| 16 |
Args:
|
| 17 |
arg1 (int): The first operand.
|
| 18 |
-
arg2 (
|
| 19 |
-
arg3 (int): The second operand.
|
| 20 |
|
| 21 |
Returns:
|
| 22 |
-
int: The
|
| 23 |
-
|
| 24 |
-
Raises:
|
| 25 |
-
ValueError: If an invalid operator is provided.
|
| 26 |
"""
|
| 27 |
-
|
| 28 |
-
return arg1 + arg3
|
| 29 |
-
elif arg2 == "-":
|
| 30 |
-
return arg1 - arg3
|
| 31 |
-
elif arg2 == "*":
|
| 32 |
-
return arg1 * arg3
|
| 33 |
-
elif arg2 == "/":
|
| 34 |
-
if arg3 == 0:
|
| 35 |
-
raise ValueError("Division by zero is not allowed.")
|
| 36 |
-
return arg1 / arg3
|
| 37 |
-
else:
|
| 38 |
-
raise ValueError("Invalid operator! Only '+', '-', '*', and '/' are allowed.")
|
| 39 |
|
| 40 |
|
| 41 |
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def calculator(arg1: int, arg2: int) -> int:
|
| 13 |
"""
|
| 14 |
+
Performs addition of two numbers.
|
| 15 |
|
| 16 |
Args:
|
| 17 |
arg1 (int): The first operand.
|
| 18 |
+
arg2 (int): The second operand.
|
|
|
|
| 19 |
|
| 20 |
Returns:
|
| 21 |
+
int: The sum of the two numbers.
|
|
|
|
|
|
|
|
|
|
| 22 |
"""
|
| 23 |
+
return arg1 + arg2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
|