Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -70,41 +70,9 @@ def check_dasha(dasha_type, name, dob, tob, lat, lon, tz):
|
|
70 |
|
71 |
return gr.Markdown(readable_response)
|
72 |
|
73 |
-
#
|
74 |
-
def check_extended_horoscope(endpoint, name, dob, tob, lat, lon, tz):
|
75 |
-
response = fetch_astrology_data(endpoint, dob, tob, lat, lon, tz) # Removed "extended-horoscope/"
|
76 |
-
|
77 |
-
# Ensure response is a dictionary
|
78 |
-
if not isinstance(response, dict):
|
79 |
-
return gr.Markdown(f"Error: Unexpected response format. Received: {response}")
|
80 |
-
|
81 |
-
readable_response = f"""
|
82 |
-
### {endpoint.replace('-', ' ').title()} Analysis for {name}
|
83 |
-
|
84 |
-
**Details:**
|
85 |
-
"""
|
86 |
-
|
87 |
-
for key, value in response.items():
|
88 |
-
if key == "bot_response": # Skip bot response
|
89 |
-
continue
|
90 |
-
readable_response += f"\n- **{key.replace('_', ' ').title()}**: "
|
91 |
-
|
92 |
-
if isinstance(value, dict):
|
93 |
-
for sub_key, sub_value in value.items():
|
94 |
-
readable_response += f"\n - {sub_key.replace('_', ' ').title()}: {sub_value}"
|
95 |
-
elif isinstance(value, list):
|
96 |
-
readable_response += "".join(f"\n - {item}" for item in value)
|
97 |
-
else:
|
98 |
-
readable_response += f"{value}"
|
99 |
-
|
100 |
-
return gr.Markdown(readable_response)
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
# Gradio UI with new buttons for extended horoscope
|
106 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
107 |
-
gr.Markdown("# 🪐 Astrology Checker - Find Your Dosha
|
108 |
|
109 |
with gr.Row():
|
110 |
name = gr.Textbox(label="Name", placeholder="Enter your name")
|
@@ -112,14 +80,14 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
112 |
tob = gr.Textbox(label="Time of Birth (HH:MM)", placeholder="11:40")
|
113 |
|
114 |
with gr.Row():
|
115 |
-
lat = gr.Number(label="Latitude", value=
|
116 |
-
lon = gr.Number(label="Longitude", value=
|
117 |
tz = gr.Number(label="Timezone (e.g., 5.5 for India)", value=5.5)
|
118 |
|
119 |
result = gr.Markdown()
|
120 |
|
121 |
-
def create_button(label,
|
122 |
-
return gr.Button(label, variant="primary").click(fn, inputs=[name, dob, tob, lat, lon, tz], outputs=result)
|
123 |
|
124 |
gr.Markdown("## 🌟 Dosha Analysis")
|
125 |
with gr.Row():
|
@@ -143,15 +111,6 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
143 |
create_button("Specific Dasha", "specific-sub-dasha", check_dasha)
|
144 |
create_button("Yogini Dasha Main", "yogini-dasha-main", check_dasha)
|
145 |
create_button("Yogini Dasha Sub", "yogini-dasha-sub", check_dasha)
|
146 |
-
|
147 |
-
gr.Markdown("## 🌙 Extended Horoscope")
|
148 |
-
with gr.Row():
|
149 |
-
create_button("Find Moon Sign", "find-moon-sign", check_extended_horoscope)
|
150 |
-
create_button("Find Sun Sign", "find-sun-sign", check_extended_horoscope)
|
151 |
-
create_button("Find Ascendant", "find-ascendant", check_extended_horoscope)
|
152 |
-
create_button("Current Sade Sati", "current-sade-sati", check_extended_horoscope)
|
153 |
-
create_button("Extended Kundli Details", "extended-kundli-details", check_extended_horoscope)
|
154 |
-
create_button("Shad Bala", "shad-bala", check_extended_horoscope)
|
155 |
|
156 |
gr.Markdown("### 🔍 Enter your details above and click the relevant button to analyze your astrology report!")
|
157 |
|
|
|
70 |
|
71 |
return gr.Markdown(readable_response)
|
72 |
|
73 |
+
# Gradio UI with improvements
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
75 |
+
gr.Markdown("# 🪐 Astrology Checker - Find Your Dosha & Dasha 🪐")
|
76 |
|
77 |
with gr.Row():
|
78 |
name = gr.Textbox(label="Name", placeholder="Enter your name")
|
|
|
80 |
tob = gr.Textbox(label="Time of Birth (HH:MM)", placeholder="11:40")
|
81 |
|
82 |
with gr.Row():
|
83 |
+
lat = gr.Number(label="Latitude", value=11)
|
84 |
+
lon = gr.Number(label="Longitude", value=77)
|
85 |
tz = gr.Number(label="Timezone (e.g., 5.5 for India)", value=5.5)
|
86 |
|
87 |
result = gr.Markdown()
|
88 |
|
89 |
+
def create_button(label, dosha_type, fn):
|
90 |
+
return gr.Button(label, variant="primary").click(fn, inputs=[gr.State(dosha_type), name, dob, tob, lat, lon, tz], outputs=result)
|
91 |
|
92 |
gr.Markdown("## 🌟 Dosha Analysis")
|
93 |
with gr.Row():
|
|
|
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 |
|