Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import datetime
|
| 3 |
+
import random
|
| 4 |
+
|
| 5 |
+
def generate_horoscope(name, birth_date, birth_time, birth_place):
|
| 6 |
+
# Simulating a basic astrology prediction
|
| 7 |
+
lucky_number = random.randint(1, 9)
|
| 8 |
+
lucky_color = random.choice(["Red", "Blue", "Green", "Yellow", "Purple"])
|
| 9 |
+
messages = [
|
| 10 |
+
"Today is a great day for introspection and planning.",
|
| 11 |
+
"You might face some challenges, but stay patient.",
|
| 12 |
+
"A financial opportunity is on the horizon.",
|
| 13 |
+
"Love and relationships may take a surprising turn.",
|
| 14 |
+
"Your hard work will be recognized soon!"
|
| 15 |
+
]
|
| 16 |
+
daily_message = random.choice(messages)
|
| 17 |
+
|
| 18 |
+
return f"Hello {name},\n\nLucky Number: {lucky_number}\nLucky Color: {lucky_color}\nDaily Insight: {daily_message}\n\n(Generated based on planetary positions on {datetime.date.today()})"
|
| 19 |
+
|
| 20 |
+
with gr.Blocks() as app:
|
| 21 |
+
gr.Markdown("# 🌟 AstroGuide – Your Daily Horoscope & Insights")
|
| 22 |
+
gr.Markdown("Enter your details below to receive your personalized astrology insights!")
|
| 23 |
+
|
| 24 |
+
name = gr.Textbox(label="Your Name")
|
| 25 |
+
birth_date = gr.Textbox(label="Birth Date (YYYY-MM-DD)")
|
| 26 |
+
birth_time = gr.Textbox(label="Birth Time (HH:MM)")
|
| 27 |
+
birth_place = gr.Textbox(label="Birth Place")
|
| 28 |
+
|
| 29 |
+
submit_btn = gr.Button("Generate Horoscope")
|
| 30 |
+
output = gr.Textbox(label="Your Daily Horoscope")
|
| 31 |
+
|
| 32 |
+
submit_btn.click(generate_horoscope, inputs=[name, birth_date, birth_time, birth_place], outputs=output)
|
| 33 |
+
|
| 34 |
+
app.launch()
|