Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -70,34 +70,35 @@ def check_dasha(dasha_type, name, dob, tob, lat, lon, tz):
|
|
70 |
|
71 |
return gr.Markdown(readable_response)
|
72 |
|
73 |
-
# Function to check Extended Horoscope
|
74 |
def check_extended_horoscope(endpoint, name, dob, tob, lat, lon, tz):
|
75 |
response = fetch_astrology_data(f"extended-horoscope/{endpoint}", dob, tob, lat, lon, tz)
|
76 |
-
if isinstance(response,
|
77 |
-
return gr.Markdown(response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
-
readable_response = f"### {endpoint.replace('-', ' ').title()} Analysis for {name}\n\n"
|
80 |
-
|
81 |
-
if endpoint == "find-moon-sign":
|
82 |
-
readable_response += f"**Moon Sign:** {response.get('moon_sign', 'N/A')}\n**Prediction:** {response.get('prediction', 'No prediction available')}"
|
83 |
-
elif endpoint == "find-sun-sign":
|
84 |
-
readable_response += f"**Sun Sign:** {response.get('sun_sign', 'N/A')}\n**Prediction:** {response.get('prediction', 'No prediction available')}"
|
85 |
-
elif endpoint == "find-ascendant":
|
86 |
-
readable_response += f"**Ascendant:** {response.get('ascendant', 'N/A')}\n**Prediction:** {response.get('prediction', 'No prediction available')}"
|
87 |
-
elif endpoint == "current-sade-sati":
|
88 |
-
readable_response += f"**Sade Sati Period:** {response.get('shani_period_type', 'N/A')}\n**Description:** {response.get('description', 'No description available')}"
|
89 |
-
elif endpoint == "extended-kundli-details":
|
90 |
-
readable_response += f"**Extended Kundli Details:** {response.get('kundli_details', 'N/A')}"
|
91 |
-
elif endpoint == "shad-bala":
|
92 |
-
readable_response += f"**Shad Bala Score:** {response.get('shad_bala', 'N/A')}\n**Prediction:** {response.get('prediction', 'No prediction available')}"
|
93 |
-
|
94 |
-
if "remedies" in response:
|
95 |
-
readable_response += "\n\n**Remedies:**"
|
96 |
-
for remedy in response['remedies']:
|
97 |
-
readable_response += f"\n- {remedy}"
|
98 |
-
|
99 |
return gr.Markdown(readable_response)
|
100 |
|
|
|
101 |
# Gradio UI with new buttons for extended horoscope
|
102 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
103 |
gr.Markdown("# 🪐 Astrology Checker - Find Your Dosha, Dasha, Moon Sign, Sun Sign, Ascendant, Sade Sati, Kundli & Shad Bala 🪐")
|
|
|
70 |
|
71 |
return gr.Markdown(readable_response)
|
72 |
|
73 |
+
# Function to check Extended Horoscope
|
74 |
def check_extended_horoscope(endpoint, name, dob, tob, lat, lon, tz):
|
75 |
response = fetch_astrology_data(f"extended-horoscope/{endpoint}", dob, tob, lat, lon, tz)
|
76 |
+
if not isinstance(response, dict) or "status" not in response or "response" not in response:
|
77 |
+
return gr.Markdown("Invalid response format.")
|
78 |
+
|
79 |
+
response_data = response.get("response", {})
|
80 |
+
readable_response = f"""
|
81 |
+
### {endpoint.replace('-', ' ').title()} Analysis for {name}
|
82 |
+
|
83 |
+
**Details:**
|
84 |
+
"""
|
85 |
+
|
86 |
+
for key, value in response_data.items():
|
87 |
+
if key == "bot_response":
|
88 |
+
continue
|
89 |
+
readable_response += f"\n- **{key.replace('_', ' ').title()}**: "
|
90 |
+
if isinstance(value, dict):
|
91 |
+
for sub_key, sub_value in value.items():
|
92 |
+
readable_response += f"\n - {sub_key.replace('_', ' ').title()}: {sub_value}"
|
93 |
+
elif isinstance(value, list):
|
94 |
+
for item in value:
|
95 |
+
readable_response += f"\n - {item}"
|
96 |
+
else:
|
97 |
+
readable_response += f"{value}"
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
return gr.Markdown(readable_response)
|
100 |
|
101 |
+
|
102 |
# Gradio UI with new buttons for extended horoscope
|
103 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
104 |
gr.Markdown("# 🪐 Astrology Checker - Find Your Dosha, Dasha, Moon Sign, Sun Sign, Ascendant, Sade Sati, Kundli & Shad Bala 🪐")
|