Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,19 +4,30 @@ import requests
|
|
4 |
import pytz
|
5 |
import yaml
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
-
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
-
# Below is
|
11 |
@tool
|
12 |
-
def
|
13 |
-
|
14 |
-
"""A tool that does nothing yet
|
15 |
Args:
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
"""
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
@tool
|
22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
4 |
import pytz
|
5 |
import yaml
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
+
from datetime import datetime, timedelta
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
+
# Below is the new deadline calculator tool
|
11 |
@tool
|
12 |
+
def deadline_calculator(start_date: str, days: int) -> dict:
|
13 |
+
"""A tool that calculates the deadline date based on a start date and a number of days.
|
|
|
14 |
Args:
|
15 |
+
start_date: The starting date in 'YYYY-MM-DD' format.
|
16 |
+
days: The number of days until the deadline.
|
17 |
+
Returns:
|
18 |
+
A dictionary containing the deadline date and the day of the week.
|
19 |
"""
|
20 |
+
try:
|
21 |
+
start = datetime.strptime(start_date, "%Y-%m-%d")
|
22 |
+
deadline = start + timedelta(days=days)
|
23 |
+
weekday = deadline.strftime("%A")
|
24 |
+
return {"Deadline": deadline.strftime("%Y-%m-%d"), "Day of Week": weekday}
|
25 |
+
except ValueError:
|
26 |
+
return {"Error": "Invalid date format. Please use 'YYYY-MM-DD'."}
|
27 |
+
|
28 |
+
# Example usage:
|
29 |
+
# print(deadline_calculator("2025-02-18", 10))
|
30 |
+
|
31 |
|
32 |
@tool
|
33 |
def get_current_time_in_timezone(timezone: str) -> str:
|