arpit13 commited on
Commit
c1a6bea
·
verified ·
1 Parent(s): 838eb4f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -72,22 +72,19 @@ def check_dasha(dasha_type, name, dob, tob, lat, lon, tz):
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
 
77
- # Ensure response is a valid dictionary
78
- if not isinstance(response, dict) or "response" not in response:
79
- return gr.Markdown("Invalid response format or missing data.")
80
 
81
- response_data = response.get("response", {})
82
-
83
- # Start formatting the response
84
  readable_response = f"""
85
  ### {endpoint.replace('-', ' ').title()} Analysis for {name}
86
 
87
  **Details:**
88
  """
89
 
90
- for key, value in response_data.items():
91
  if key == "bot_response": # Skip bot response
92
  continue
93
  readable_response += f"\n- **{key.replace('_', ' ').title()}**: "
@@ -104,6 +101,7 @@ def check_extended_horoscope(endpoint, name, dob, tob, lat, lon, tz):
104
 
105
 
106
 
 
107
  # Gradio UI with new buttons for extended horoscope
108
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
109
  gr.Markdown("# 🪐 Astrology Checker - Find Your Dosha, Dasha, Moon Sign, Sun Sign, Ascendant, Sade Sati, Kundli & Shad Bala 🪐")
 
72
 
73
  # Function to check Extended Horoscope
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()}**: "
 
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, Dasha, Moon Sign, Sun Sign, Ascendant, Sade Sati, Kundli & Shad Bala 🪐")