Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,14 +12,22 @@ from Gradio_UI import GradioUI
|
|
| 12 |
def sum_tool(num1: int, num2: int) -> int:
|
| 13 |
""" A tool that adds up the two integers
|
| 14 |
Args:
|
| 15 |
-
num1:
|
| 16 |
-
num2:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
"""
|
|
|
|
|
|
|
|
|
|
| 18 |
try:
|
| 19 |
res = num1 + num2
|
| 20 |
return f"The sum of two integers is: {res}"
|
| 21 |
except Exception as e:
|
| 22 |
-
return f"
|
| 23 |
|
| 24 |
|
| 25 |
@tool
|
|
|
|
| 12 |
def sum_tool(num1: int, num2: int) -> int:
|
| 13 |
""" A tool that adds up the two integers
|
| 14 |
Args:
|
| 15 |
+
num1: The first integer to add
|
| 16 |
+
num2: The second integer to add
|
| 17 |
+
Returns:
|
| 18 |
+
int: A integer contains the sum of the two integers.
|
| 19 |
+
|
| 20 |
+
Raises:
|
| 21 |
+
TypeError: If either num1 or num2 is not an integer.
|
| 22 |
"""
|
| 23 |
+
if not isinstance(num1, int) or not isinstance(num2, int):
|
| 24 |
+
raise TypeError("Both inputs must be integers")
|
| 25 |
+
|
| 26 |
try:
|
| 27 |
res = num1 + num2
|
| 28 |
return f"The sum of two integers is: {res}"
|
| 29 |
except Exception as e:
|
| 30 |
+
return f"An error occurred: {str(e)}"
|
| 31 |
|
| 32 |
|
| 33 |
@tool
|