Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,21 +13,21 @@ def estimate_marathon_time(half_time: str) -> str:
|
|
| 13 |
"""
|
| 14 |
Estimates a full marathon time based on a given half-marathon time.
|
| 15 |
|
| 16 |
-
|
| 17 |
-
half_time (str): The recorded half-marathon time in the format HH:MM.
|
| 18 |
|
| 19 |
Returns:
|
| 20 |
-
str: The estimated full marathon time in HH:MM format.
|
| 21 |
"""
|
| 22 |
try:
|
| 23 |
hours, minutes = map(int, half_time.split(":"))
|
| 24 |
total_minutes = hours * 60 + minutes
|
| 25 |
-
estimated_full_time = total_minutes * 2.1 # Common factor
|
| 26 |
full_hours = int(estimated_full_time // 60)
|
| 27 |
full_minutes = int(estimated_full_time % 60)
|
| 28 |
return f"{full_hours}:{full_minutes:02d}"
|
| 29 |
-
except:
|
| 30 |
-
return "Invalid half-marathon time format. Please use HH:MM."
|
| 31 |
|
| 32 |
@tool
|
| 33 |
def check_missing_info() -> str:
|
|
|
|
| 13 |
"""
|
| 14 |
Estimates a full marathon time based on a given half-marathon time.
|
| 15 |
|
| 16 |
+
Parameters:
|
| 17 |
+
half_time (str): The recorded half-marathon time in the format 'HH:MM'.
|
| 18 |
|
| 19 |
Returns:
|
| 20 |
+
str: The estimated full marathon time in 'HH:MM' format.
|
| 21 |
"""
|
| 22 |
try:
|
| 23 |
hours, minutes = map(int, half_time.split(":"))
|
| 24 |
total_minutes = hours * 60 + minutes
|
| 25 |
+
estimated_full_time = total_minutes * 2.1 # Common estimation factor
|
| 26 |
full_hours = int(estimated_full_time // 60)
|
| 27 |
full_minutes = int(estimated_full_time % 60)
|
| 28 |
return f"{full_hours}:{full_minutes:02d}"
|
| 29 |
+
except ValueError:
|
| 30 |
+
return "Invalid half-marathon time format. Please use 'HH:MM'."
|
| 31 |
|
| 32 |
@tool
|
| 33 |
def check_missing_info() -> str:
|