Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,25 @@ def days_before_season(local_time:str, season:str)-> str: #it's import to specif
|
|
16 |
local_time: local time
|
17 |
season: a season of the year
|
18 |
"""
|
19 |
-
days = season_start - local_time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
return f"Until {season} are {days} left."
|
21 |
|
22 |
@tool
|
|
|
16 |
local_time: local time
|
17 |
season: a season of the year
|
18 |
"""
|
19 |
+
# days = season_start - local_time
|
20 |
+
# Current time
|
21 |
+
current_time = datetime.strptime(local_time, "%Y-%m-%d %H:%M:%S")
|
22 |
+
|
23 |
+
if season == "spring":
|
24 |
+
spring_start = datetime(2025, 03, 01)
|
25 |
+
# Calculate the difference
|
26 |
+
days = (spring_start - current_time).days
|
27 |
+
elif season == "summer":
|
28 |
+
summer_start = datetime(2025, 06, 01)
|
29 |
+
# Calculate the difference
|
30 |
+
days = (summer_start - current_time).days
|
31 |
+
elif season == "autumn":
|
32 |
+
autumn_start = datetime(2025, 09, 01)
|
33 |
+
# Calculate the difference
|
34 |
+
days = (autumn_start - current_time).days
|
35 |
+
elif season == "winter":
|
36 |
+
return "I cannot calculate days until the winter because it's currently a winter"
|
37 |
+
|
38 |
return f"Until {season} are {days} left."
|
39 |
|
40 |
@tool
|