AstroFun / app.py
Bhavibond's picture
Update app.py
60378a0 verified
import gradio as gr
import datetime
import random
import requests
def get_planetary_transits():
# Placeholder function (Replace with an API call if available)
return "Sun in Pisces, Moon in Leo, Mars in Capricorn"
def generate_horoscope(name, birth_date, birth_time, birth_place):
# Get planetary transits
transits = get_planetary_transits()
# Simulating a detailed astrology prediction
lucky_number = random.randint(1, 9)
lucky_color = random.choice(["Red", "Blue", "Green", "Yellow", "Purple"])
messages = [
"Today is a great day for introspection and planning.",
"You might face some challenges, but stay patient.",
"A financial opportunity is on the horizon.",
"Love and relationships may take a surprising turn.",
"Your hard work will be recognized soon!"
]
daily_message = random.choice(messages)
return f"Hello {name},\n\nLucky Number: {lucky_number}\nLucky Color: {lucky_color}\nPlanetary Transits: {transits}\nDaily Insight: {daily_message}\n\n(Generated based on planetary positions on {datetime.date.today()})"
with gr.Blocks() as app:
gr.Markdown("# 🌟 AstroGuide – Your Daily Horoscope & Insights")
gr.Markdown("Enter your details below to receive your personalized astrology insights!")
name = gr.Textbox(label="Your Name")
birth_date = gr.Textbox(label="Birth Date (YYYY-MM-DD)")
birth_time = gr.Textbox(label="Birth Time (HH:MM)")
birth_place = gr.Textbox(label="Birth Place")
submit_btn = gr.Button("Generate Horoscope")
output = gr.Textbox(label="Your Detailed Horoscope")
submit_btn.click(generate_horoscope, inputs=[name, birth_date, birth_time, birth_place], outputs=output)
app.launch()