Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -55,14 +55,19 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
55 |
|
56 |
@tool
|
57 |
def calculate_bmi(weight: float, height: float) -> str:
|
58 |
-
"""A tool that calculates the Body Mass Index (BMI) given weight
|
59 |
and provides health recommendations based on the BMI value.
|
60 |
|
61 |
Args:
|
62 |
weight: Your weight in kilograms.
|
63 |
-
height: Your height in meters.
|
|
|
64 |
"""
|
65 |
try:
|
|
|
|
|
|
|
|
|
66 |
bmi = weight / (height ** 2)
|
67 |
bmi = round(bmi, 2)
|
68 |
|
|
|
55 |
|
56 |
@tool
|
57 |
def calculate_bmi(weight: float, height: float) -> str:
|
58 |
+
"""A tool that calculates the Body Mass Index (BMI) given weight and height,
|
59 |
and provides health recommendations based on the BMI value.
|
60 |
|
61 |
Args:
|
62 |
weight: Your weight in kilograms.
|
63 |
+
height: Your height in meters or centimeters.
|
64 |
+
If the value is greater than 3, it is assumed to be in centimeters.
|
65 |
"""
|
66 |
try:
|
67 |
+
# If height is provided in centimeters (i.e., greater than 3), convert to meters.
|
68 |
+
if height > 3:
|
69 |
+
height = height / 100.0
|
70 |
+
|
71 |
bmi = weight / (height ** 2)
|
72 |
bmi = round(bmi, 2)
|
73 |
|