Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -55,7 +55,21 @@ def get_horoscope(sign: str, date: str = None) -> str:
|
|
55 |
# Placeholder logic
|
56 |
if not date:
|
57 |
date = datetime.now().strftime("%Y-%m-%d")
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
@tool
|
61 |
def get_date_panchang(date: str = None) -> str:
|
|
|
55 |
# Placeholder logic
|
56 |
if not date:
|
57 |
date = datetime.now().strftime("%Y-%m-%d")
|
58 |
+
|
59 |
+
url = "https://api.exaweb.in:3004/api/rashi"
|
60 |
+
try:
|
61 |
+
response = requests.get(url, params={"language": language, "rashi": sign.upper(), "date": date})
|
62 |
+
response.raise_for_status()
|
63 |
+
data = response.json()
|
64 |
+
|
65 |
+
# Extract the horoscope
|
66 |
+
horoscope = data.get("rashiData", {}).get("prediction") or "No prediction found."
|
67 |
+
today = datetime.now().strftime("%Y-%m-%d")
|
68 |
+
|
69 |
+
return f"Horoscope for {sign.capitalize()} on {today}:\n{horoscope}"
|
70 |
+
|
71 |
+
except Exception as e:
|
72 |
+
return f"Failed to fetch horoscope for {sign}: {str(e)}"
|
73 |
|
74 |
@tool
|
75 |
def get_date_panchang(date: str = None) -> str:
|