Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,11 +11,11 @@ from Gradio_UI import GradioUI
|
|
11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
12 |
|
13 |
|
14 |
-
def parse_date(date_str: str) ->
|
15 |
try:
|
16 |
-
return parser.parse(date_str)
|
17 |
except:
|
18 |
-
return datetime.now()
|
19 |
|
20 |
|
21 |
@tool
|
@@ -58,16 +58,16 @@ def get_horoscope(sign: str, date: str = None, language: str = "EN") -> str:
|
|
58 |
if date:
|
59 |
date_obj = parse_date(date)
|
60 |
else:
|
61 |
-
date_obj = datetime.now()
|
|
|
62 |
formatted_date = date_obj.strftime("%d-%m-%Y")
|
63 |
|
64 |
-
#
|
65 |
url = "https://api.exaweb.in:3004/api/rashi/getForAllLangs"
|
66 |
response = requests.get(url, params={"day": formatted_date, "language": language})
|
67 |
response.raise_for_status()
|
68 |
data = response.json()
|
69 |
|
70 |
-
# Find horoscope for the given sign
|
71 |
sign_upper = sign.upper()
|
72 |
for item in data.get("data", []):
|
73 |
if item.get("sign", "").upper() == sign_upper:
|
|
|
11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
12 |
|
13 |
|
14 |
+
def parse_date(date_str: str) -> datetime.datetime: # Note the type hint change
|
15 |
try:
|
16 |
+
return parser.parse(date_str)
|
17 |
except:
|
18 |
+
return datetime.datetime.now() # Changed here
|
19 |
|
20 |
|
21 |
@tool
|
|
|
58 |
if date:
|
59 |
date_obj = parse_date(date)
|
60 |
else:
|
61 |
+
date_obj = datetime.datetime.now() # Changed here
|
62 |
+
|
63 |
formatted_date = date_obj.strftime("%d-%m-%Y")
|
64 |
|
65 |
+
# ... (rest of the function is the same)
|
66 |
url = "https://api.exaweb.in:3004/api/rashi/getForAllLangs"
|
67 |
response = requests.get(url, params={"day": formatted_date, "language": language})
|
68 |
response.raise_for_status()
|
69 |
data = response.json()
|
70 |
|
|
|
71 |
sign_upper = sign.upper()
|
72 |
for item in data.get("data", []):
|
73 |
if item.get("sign", "").upper() == sign_upper:
|