arpit13 commited on
Commit
d796ca3
·
verified ·
1 Parent(s): 0804605

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -4
app.py CHANGED
@@ -33,16 +33,15 @@ def check_dosha(dosha_type, name, dob, tob, lat, lon, tz):
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
 
@@ -52,7 +51,24 @@ def check_dasha(dasha_type, name, dob, tob, lat, lon, tz):
52
  if isinstance(response, str):
53
  return gr.Markdown(response)
54
 
55
- return gr.Markdown(f"### {dasha_type.replace('-', ' ').title()} Analysis for {name}\n\n" + str(response))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
  # Gradio UI with improvements
58
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
 
33
  """
34
 
35
  for key, value in response.items():
36
+ readable_response += f"\n- **{key.replace('_', ' ').title()}**: "
37
  if isinstance(value, dict):
 
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
  for item in value:
42
  readable_response += f"\n - {item}"
43
  else:
44
+ readable_response += f"{value}"
45
 
46
  return gr.Markdown(readable_response)
47
 
 
51
  if isinstance(response, str):
52
  return gr.Markdown(response)
53
 
54
+ readable_response = f"""
55
+ ### {dasha_type.replace('-', ' ').title()} Analysis for {name}
56
+
57
+ **Details:**
58
+ """
59
+
60
+ for key, value in response.items():
61
+ readable_response += f"\n- **{key.replace('_', ' ').title()}**: "
62
+ if isinstance(value, dict):
63
+ for sub_key, sub_value in value.items():
64
+ readable_response += f"\n - {sub_key.replace('_', ' ').title()}: {sub_value}"
65
+ elif isinstance(value, list):
66
+ for item in value:
67
+ readable_response += f"\n - {item}"
68
+ else:
69
+ readable_response += f"{value}"
70
+
71
+ return gr.Markdown(readable_response)
72
 
73
  # Gradio UI with improvements
74
  with gr.Blocks(theme=gr.themes.Soft()) as demo: