gaur3009 commited on
Commit
6daa27f
·
verified ·
1 Parent(s): 71935dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -27
app.py CHANGED
@@ -1,29 +1,36 @@
1
  import gradio as gr
 
 
 
2
  from vedicastro.VedicAstro import VedicHoroscopeData
3
 
4
- # Function to generate horoscope and predictions
5
- def generate_horoscope(name, year, month, day, hour, minute, latitude, longitude, utc):
6
- vhd = VedicHoroscopeData(
7
- year=year, month=month, day=day,
8
- hour=hour, minute=minute, second=0,
9
- utc=utc, latitude=latitude, longitude=longitude,
10
- ayanamsa="Lahiri", house_system="Equal"
11
- )
12
-
13
- chart = vhd.generate_chart()
14
- planets_data = vhd.get_planets_data_from_chart(chart)
15
- houses_data = vhd.get_houses_data_from_chart(chart)
16
- dasa_data = vhd.compute_vimshottari_dasa(chart)
17
-
18
- prediction = f"### Horoscope for {name}\n\n"
19
- prediction += f"#### Planetary Positions\n{planets_data}\n\n"
20
- prediction += f"#### House Data\n{houses_data}\n\n"
21
- prediction += f"#### Vimshottari Dasa\n{dasa_data}\n\n"
22
-
23
- return prediction
24
 
25
- # UI with Gradio
26
- demo = gr.Interface(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  fn=generate_horoscope,
28
  inputs=[
29
  gr.Textbox(label="Name"),
@@ -32,13 +39,14 @@ demo = gr.Interface(
32
  gr.Number(label="Day of Birth", value=1),
33
  gr.Number(label="Hour of Birth", value=12),
34
  gr.Number(label="Minute of Birth", value=0),
35
- gr.Number(label="Latitude", value=28.6139),
36
  gr.Number(label="Longitude", value=77.2090),
37
- gr.Textbox(label="UTC Offset", value="+5:30"),
38
  ],
39
  outputs=gr.Markdown(),
40
- title="AI Vedic Astrology Bot",
41
- description="Enter your birth details to generate a detailed Vedic astrology report."
42
  )
43
 
44
- demo.launch()
 
 
1
  import gradio as gr
2
+ import pytz
3
+ import swisseph as swe
4
+ from datetime import datetime
5
  from vedicastro.VedicAstro import VedicHoroscopeData
6
 
7
+ # Function to generate horoscope
8
+ def generate_horoscope(name, year, month, day, hour, minute, latitude, longitude, utc_offset):
9
+ try:
10
+ vhd = VedicHoroscopeData(
11
+ year=year, month=month, day=day,
12
+ hour=hour, minute=minute, second=0,
13
+ utc=utc_offset, latitude=latitude, longitude=longitude,
14
+ ayanamsa="Lahiri", house_system="Equal"
15
+ )
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ chart = vhd.generate_chart()
18
+ planets_data = vhd.get_planets_data_from_chart(chart)
19
+ houses_data = vhd.get_houses_data_from_chart(chart)
20
+ dasa_data = vhd.compute_vimshottari_dasa(chart)
21
+
22
+ prediction = f"## Horoscope for {name}\n\n"
23
+ prediction += f"### 🌟 Planetary Positions\n{planets_data}\n\n"
24
+ prediction += f"### 🏠 House Data\n{houses_data}\n\n"
25
+ prediction += f"### 🔮 Vimshottari Dasa (Predictions)\n{dasa_data}\n\n"
26
+
27
+ return prediction
28
+
29
+ except Exception as e:
30
+ return f"Error generating horoscope: {str(e)}"
31
+
32
+ # Define Gradio UI
33
+ iface = gr.Interface(
34
  fn=generate_horoscope,
35
  inputs=[
36
  gr.Textbox(label="Name"),
 
39
  gr.Number(label="Day of Birth", value=1),
40
  gr.Number(label="Hour of Birth", value=12),
41
  gr.Number(label="Minute of Birth", value=0),
42
+ gr.Number(label="Latitude", value=28.6139), # Default: New Delhi
43
  gr.Number(label="Longitude", value=77.2090),
44
+ gr.Textbox(label="UTC Offset (e.g., +5.30)", value="+5.30"),
45
  ],
46
  outputs=gr.Markdown(),
47
+ title="🔮 AI Vedic Astrology Model",
48
+ description="Enter your birth details to generate a North Indian-style horoscope chart and AI-driven life predictions."
49
  )
50
 
51
+ if __name__ == "__main__":
52
+ iface.launch()