Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -70,9 +70,37 @@ def check_dasha(dasha_type, name, dob, tob, lat, lon, tz):
|
|
70 |
|
71 |
return gr.Markdown(readable_response)
|
72 |
|
73 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
75 |
-
gr.Markdown("# 🪐 Astrology Checker - Find Your Dosha &
|
76 |
|
77 |
with gr.Row():
|
78 |
name = gr.Textbox(label="Name", placeholder="Enter your name")
|
@@ -86,8 +114,8 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
86 |
|
87 |
result = gr.Markdown()
|
88 |
|
89 |
-
def create_button(label,
|
90 |
-
return gr.Button(label, variant="primary").click(fn, inputs=[
|
91 |
|
92 |
gr.Markdown("## 🌟 Dosha Analysis")
|
93 |
with gr.Row():
|
@@ -111,6 +139,15 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
111 |
create_button("Specific Dasha", "specific-sub-dasha", check_dasha)
|
112 |
create_button("Yogini Dasha Main", "yogini-dasha-main", check_dasha)
|
113 |
create_button("Yogini Dasha Sub", "yogini-dasha-sub", check_dasha)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
gr.Markdown("### 🔍 Enter your details above and click the relevant button to analyze your astrology report!")
|
116 |
|
|
|
70 |
|
71 |
return gr.Markdown(readable_response)
|
72 |
|
73 |
+
# Function to check Extended Horoscope (Moon Sign, Sun Sign, Ascendant, etc.)
|
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, str):
|
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 🪐")
|
104 |
|
105 |
with gr.Row():
|
106 |
name = gr.Textbox(label="Name", placeholder="Enter your name")
|
|
|
114 |
|
115 |
result = gr.Markdown()
|
116 |
|
117 |
+
def create_button(label, endpoint, fn):
|
118 |
+
return gr.Button(label, variant="primary").click(fn, inputs=[name, dob, tob, lat, lon, tz], outputs=result)
|
119 |
|
120 |
gr.Markdown("## 🌟 Dosha Analysis")
|
121 |
with gr.Row():
|
|
|
139 |
create_button("Specific Dasha", "specific-sub-dasha", check_dasha)
|
140 |
create_button("Yogini Dasha Main", "yogini-dasha-main", check_dasha)
|
141 |
create_button("Yogini Dasha Sub", "yogini-dasha-sub", check_dasha)
|
142 |
+
|
143 |
+
gr.Markdown("## 🌙 Extended Horoscope")
|
144 |
+
with gr.Row():
|
145 |
+
create_button("Find Moon Sign", "find-moon-sign", check_extended_horoscope)
|
146 |
+
create_button("Find Sun Sign", "find-sun-sign", check_extended_horoscope)
|
147 |
+
create_button("Find Ascendant", "find-ascendant", check_extended_horoscope)
|
148 |
+
create_button("Current Sade Sati", "current-sade-sati", check_extended_horoscope)
|
149 |
+
create_button("Extended Kundli Details", "extended-kundli-details", check_extended_horoscope)
|
150 |
+
create_button("Shad Bala", "shad-bala", check_extended_horoscope)
|
151 |
|
152 |
gr.Markdown("### 🔍 Enter your details above and click the relevant button to analyze your astrology report!")
|
153 |
|