Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ 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 mathematic_operation(num1:int | float, num2:int | float, ops: str)->
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
"""A tool that does mathematical operation of addition, subtraction, division, and multiplication
|
| 15 |
Args:
|
|
@@ -19,13 +19,13 @@ def mathematic_operation(num1:int | float, num2:int | float, ops: str)-> int | f
|
|
| 19 |
"""
|
| 20 |
|
| 21 |
if ops == "add":
|
| 22 |
-
return num1 + num2
|
| 23 |
elif ops == "subtract":
|
| 24 |
-
return num1 - num2
|
| 25 |
elif ops =="div":
|
| 26 |
-
return num1/num2
|
| 27 |
elif ops == 'multiply':
|
| 28 |
-
return num1*num2
|
| 29 |
else:
|
| 30 |
return f"Operation {ops} is not available, please only use 'add','substract','div', and 'multiply'"
|
| 31 |
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def mathematic_operation(num1:int | float, num2:int | float, ops: str)-> str: #it's import to specify the return type
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
"""A tool that does mathematical operation of addition, subtraction, division, and multiplication
|
| 15 |
Args:
|
|
|
|
| 19 |
"""
|
| 20 |
|
| 21 |
if ops == "add":
|
| 22 |
+
return str(num1 + num2)
|
| 23 |
elif ops == "subtract":
|
| 24 |
+
return str(num1 - num2)
|
| 25 |
elif ops =="div":
|
| 26 |
+
return str(num1/num2)
|
| 27 |
elif ops == 'multiply':
|
| 28 |
+
return str(num1*num2)
|
| 29 |
else:
|
| 30 |
return f"Operation {ops} is not available, please only use 'add','substract','div', and 'multiply'"
|
| 31 |
|