Spaces:
Runtime error
Runtime error
Update app.py
#1
by
giacomosachs
- opened
app.py
CHANGED
|
@@ -33,6 +33,22 @@ 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 |
model = HfApiModel(
|
|
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
+
@tool
|
| 37 |
+
def evaluate_logarithm(value: float, base: float = math.e) -> str:
|
| 38 |
+
"""A tool that evaluates the value of a logarithm. If no base is provided, e (Euler's number) is used.
|
| 39 |
+
Args:
|
| 40 |
+
value: the float which logarithm is to be evaluated.
|
| 41 |
+
base: logarithm base.
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
import math
|
| 45 |
+
try:
|
| 46 |
+
log_value = math.log(value, base)
|
| 47 |
+
return f"The logarithm using base {base} of {value} is: {log_value}"
|
| 48 |
+
except Exception as e:
|
| 49 |
+
return f"Error evaluating logarithm using base {base} for value {value}: {str(e)}"
|
| 50 |
+
|
| 51 |
+
|
| 52 |
|
| 53 |
final_answer = FinalAnswerTool()
|
| 54 |
model = HfApiModel(
|