Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,24 +23,27 @@ def check_dosha(dosha_type, name, dob, tob, lat, lon, tz):
|
|
| 23 |
if isinstance(response, str):
|
| 24 |
return gr.Markdown(response)
|
| 25 |
|
| 26 |
-
factors = response.get("factors", {})
|
| 27 |
-
dosha_present = response.get("is_dosha_present", False)
|
| 28 |
-
bot_response = response.get("bot_response", "No information available")
|
| 29 |
-
score = response.get("score", "N/A")
|
| 30 |
-
|
| 31 |
readable_response = f"""
|
| 32 |
### {dosha_type.replace('-', ' ').title()} Analysis for {name}
|
| 33 |
|
| 34 |
-
**Dosha Presence:** {'Yes' if
|
| 35 |
-
**Score:** {score}%
|
| 36 |
-
|
| 37 |
-
**Detailed Analysis:**
|
| 38 |
-
- **Moon Influence:** {factors.get('moon', 'Not mentioned')}
|
| 39 |
-
- **Saturn Influence:** {factors.get('saturn', 'Not mentioned')}
|
| 40 |
-
- **Rahu Influence:** {factors.get('rahu', 'Not mentioned')}
|
| 41 |
|
| 42 |
-
**
|
| 43 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
return gr.Markdown(readable_response)
|
| 45 |
|
| 46 |
# Function to check Dasha
|
|
|
|
| 23 |
if isinstance(response, str):
|
| 24 |
return gr.Markdown(response)
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
readable_response = f"""
|
| 27 |
### {dosha_type.replace('-', ' ').title()} Analysis for {name}
|
| 28 |
|
| 29 |
+
**Dosha Presence:** {'Yes' if response.get('is_dosha_present', False) else 'No'}
|
| 30 |
+
**Score:** {response.get('score', 'N/A')}%
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
+
**Details:**
|
| 33 |
"""
|
| 34 |
+
|
| 35 |
+
for key, value in response.items():
|
| 36 |
+
if isinstance(value, dict):
|
| 37 |
+
readable_response += f"\n- **{key.replace('_', ' ').title()}**: "
|
| 38 |
+
for sub_key, sub_value in value.items():
|
| 39 |
+
readable_response += f"\n - {sub_key.replace('_', ' ').title()}: {sub_value}"
|
| 40 |
+
elif isinstance(value, list):
|
| 41 |
+
readable_response += f"\n- **{key.replace('_', ' ').title()}**: "
|
| 42 |
+
for item in value:
|
| 43 |
+
readable_response += f"\n - {item}"
|
| 44 |
+
else:
|
| 45 |
+
readable_response += f"\n- **{key.replace('_', ' ').title()}**: {value}"
|
| 46 |
+
|
| 47 |
return gr.Markdown(readable_response)
|
| 48 |
|
| 49 |
# Function to check Dasha
|