Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -33,6 +33,28 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
final_answer = FinalAnswerTool()
|
38 |
|
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
+
@tool
|
37 |
+
def calculator(num_1: float, num_2: float, sign: str) -> float|str:
|
38 |
+
""" A tool tha receives two numbers and a sign and execute the sign operation over that two numbers.
|
39 |
+
Args:
|
40 |
+
num_1: first number to be computed
|
41 |
+
num_2: second number to be computed
|
42 |
+
sign: the operation sign
|
43 |
+
"""
|
44 |
+
if sign == '+':
|
45 |
+
return num_1+num_2
|
46 |
+
elif sign == '-':
|
47 |
+
return num_1-num_2
|
48 |
+
elif sign == '*':
|
49 |
+
return num_1*num_2
|
50 |
+
elif sign == '/':
|
51 |
+
if num_2 != 0:
|
52 |
+
return num_1/num_2
|
53 |
+
else:
|
54 |
+
return 'You can't make a division by 0!'
|
55 |
+
else:
|
56 |
+
return 'Sign not recognized!'
|
57 |
+
|
58 |
|
59 |
final_answer = FinalAnswerTool()
|
60 |
|