Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,45 +49,7 @@ def check_dasha(dasha_type, name, dob, tob, lat, lon, tz):
|
|
| 49 |
if isinstance(response, str):
|
| 50 |
return gr.Markdown(response)
|
| 51 |
|
| 52 |
-
|
| 53 |
-
mahadasha = response.get("mahadasha", [])
|
| 54 |
-
mahadasha_order = response.get("mahadasha_order", [])
|
| 55 |
-
dasha_start_date = response.get("dasha_start_date", "N/A")
|
| 56 |
-
dasha_remaining_at_birth = response.get("dasha_remaining_at_birth", "N/A")
|
| 57 |
-
|
| 58 |
-
# Format the dasha data to make it more readable
|
| 59 |
-
readable_response = f"""
|
| 60 |
-
### {dasha_type.replace('-', ' ').title()} Analysis for {name}
|
| 61 |
-
|
| 62 |
-
**Dasha Start Date:** {dasha_start_date}
|
| 63 |
-
|
| 64 |
-
**Remaining Dasha at Birth:** {dasha_remaining_at_birth}
|
| 65 |
-
|
| 66 |
-
## Mahadasha Sequence:
|
| 67 |
-
Here is the order of your Mahadasha periods:
|
| 68 |
-
"""
|
| 69 |
-
|
| 70 |
-
if len(mahadasha) == 0 or len(mahadasha_order) == 0:
|
| 71 |
-
readable_response += "**No Mahadasha data available.**"
|
| 72 |
-
else:
|
| 73 |
-
table = "| **Period** | **Planet** |\n|--------------|---------------|\n"
|
| 74 |
-
for i in range(len(mahadasha)):
|
| 75 |
-
if i < len(mahadasha_order):
|
| 76 |
-
period = mahadasha_order[i]
|
| 77 |
-
planet = mahadasha[i]
|
| 78 |
-
table += f"| {period} | {planet} |\n"
|
| 79 |
-
|
| 80 |
-
readable_response += table
|
| 81 |
-
|
| 82 |
-
if not mahadasha or not mahadasha_order:
|
| 83 |
-
readable_response += "\n## Astrological Insights: Data not available for the current period."
|
| 84 |
-
else:
|
| 85 |
-
readable_response += """
|
| 86 |
-
## Astrological Insights:
|
| 87 |
-
Based on your Mahadasha periods, you can predict the influences of each planet during your life.
|
| 88 |
-
"""
|
| 89 |
-
|
| 90 |
-
return gr.Markdown(readable_response)
|
| 91 |
|
| 92 |
# Gradio UI with improvements
|
| 93 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
@@ -122,6 +84,14 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 122 |
create_button("Mahadasha Predictions", "maha-dasha-predictions", check_dasha)
|
| 123 |
create_button("Antardasha", "antar-dasha", check_dasha)
|
| 124 |
create_button("Char Dasha Current", "char-dasha-current", check_dasha)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
gr.Markdown("### 🔍 Enter your details above and click the relevant button to analyze your astrology report!")
|
| 127 |
|
|
|
|
| 49 |
if isinstance(response, str):
|
| 50 |
return gr.Markdown(response)
|
| 51 |
|
| 52 |
+
return gr.Markdown(f"### {dasha_type.replace('-', ' ').title()} Analysis for {name}\n\n" + str(response))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
# Gradio UI with improvements
|
| 55 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
|
|
| 84 |
create_button("Mahadasha Predictions", "maha-dasha-predictions", check_dasha)
|
| 85 |
create_button("Antardasha", "antar-dasha", check_dasha)
|
| 86 |
create_button("Char Dasha Current", "char-dasha-current", check_dasha)
|
| 87 |
+
create_button("Char Dasha Main", "char-dasha-main", check_dasha)
|
| 88 |
+
create_button("Char Dasha Sub", "char-dasha-sub", check_dasha)
|
| 89 |
+
create_button("Current Mahadasha Full", "current-mahadasha-full", check_dasha)
|
| 90 |
+
create_button("Current Mahadasha", "current-mahadasha", check_dasha)
|
| 91 |
+
create_button("Paryantar Dasha", "paryantar-dasha", check_dasha)
|
| 92 |
+
create_button("Specific Dasha", "specific-sub-dasha", check_dasha)
|
| 93 |
+
create_button("Yogini Dasha Main", "yogini-dasha-main", check_dasha)
|
| 94 |
+
create_button("Yogini Dasha Sub", "yogini-dasha-sub", check_dasha)
|
| 95 |
|
| 96 |
gr.Markdown("### 🔍 Enter your details above and click the relevant button to analyze your astrology report!")
|
| 97 |
|