Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,22 +9,21 @@ 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(x: int | float, y: int | float, operation: str)->
|
13 |
-
#Keep this format for the description / args / args description but feel free to modify the tool
|
14 |
"""A tool that performs an operation between x and y.
|
15 |
Args:
|
16 |
-
x: first integer or float in the calculation
|
17 |
-
y: second integer or float in the calculation
|
18 |
-
operation: one of ["+", "-", "*", "/"]
|
19 |
"""
|
20 |
if operation == "+":
|
21 |
-
return x +
|
22 |
elif operation == "-":
|
23 |
-
return x -
|
24 |
elif operation == "*":
|
25 |
-
return x *
|
26 |
elif operation == "/":
|
27 |
-
return x /
|
28 |
else:
|
29 |
raise ValueError("operation must be one of ['+', '-', '*', '/']")
|
30 |
|
|
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
12 |
+
def calculator(x: int | float, y: int | float, operation: str)-> str:
|
|
|
13 |
"""A tool that performs an operation between x and y.
|
14 |
Args:
|
15 |
+
x: first integer or float in the calculation.
|
16 |
+
y: second integer or float in the calculation.
|
17 |
+
operation: one of ["+", "-", "*", "/"].
|
18 |
"""
|
19 |
if operation == "+":
|
20 |
+
return str(f"{x}+{y} = {x+y}")
|
21 |
elif operation == "-":
|
22 |
+
return str(f"{x}-{y} = {x-y}")
|
23 |
elif operation == "*":
|
24 |
+
return str(f"{x}*{y} = {x*y}")
|
25 |
elif operation == "/":
|
26 |
+
return str(f"{x}/{y} = {x/y}")
|
27 |
else:
|
28 |
raise ValueError("operation must be one of ['+', '-', '*', '/']")
|
29 |
|