Luis commited on
Commit
a43d707
·
verified ·
1 Parent(s): 72647b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -11
app.py CHANGED
@@ -1,7 +1,7 @@
1
  #Just havinfg the original template here, in case we need to duplicate
2
 
3
  from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
4
- import datetime
5
  import requests
6
  import pytz
7
  import yaml
@@ -22,16 +22,20 @@ def time_left_for_event(event:str, date:str)-> str: #it's import to specify the
22
  """
23
 
24
  try:
25
- # Calculate Todays date
26
- today = datetime.datetime.now()
27
- # calculate the events date difference
28
- difference = event_date - today
29
- # Convert the difference into months, weeks or days
30
- if difference < 7:
31
- ans = f"{difference} days"
32
- elif difference > 7:
33
- ans = f"{difference} weeks"
34
- return f"you have the following time: {ans}"
 
 
 
 
35
  except Exception as e:
36
  return f"Error: {e}"
37
 
 
1
  #Just havinfg the original template here, in case we need to duplicate
2
 
3
  from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
4
+ from datetime import datetime
5
  import requests
6
  import pytz
7
  import yaml
 
22
  """
23
 
24
  try:
25
+ # Get today's date
26
+ today = datetime.now()
27
+ # Define the wedding date
28
+ event_year = today.year
29
+ event_date = datetime(event_year, 3, 22)y
30
+ # Calculate the difference
31
+ time_difference = event_date - today
32
+ # Get the number of days left
33
+ days_left = time_difference.days
34
+ weeks_left = time_difference.weeks
35
+ months_left = time_difference.months
36
+
37
+ return f"you have the following time: {months_left}, {weeks_left}, {days_left}"
38
+
39
  except Exception as e:
40
  return f"Error: {e}"
41