import gradio as gr import requests PLACEHOLDER = """

Daily Horoscope by Enemy AI

""" CSS = """ .card { border: 1px solid black; border-radius: 10px; padding: 10px; text-align: center; box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3); margin: 10px; } h3 { text-align: center; } .button-container { text-align: center; margin-top: 20px; } .result-container { margin-top: 20px; } """ ASTROSEEK_API_URL = "https://api.astroseek.com/horoscope/daily" # Horoscope Function def get_horoscope(sign): response = requests.get(f"{ASTROSEEK_API_URL}/{sign}") if response.status_code == 200: data = response.json() return data.get("horoscope", "No horoscope available for today.") else: return "Error retrieving horoscope. Please try again later." with gr.Blocks(theme="soft", css=CSS) as demo: gr.Markdown(PLACEHOLDER) gr.Markdown("### Get your daily horoscope.") horoscope_output = gr.HTML() sign_dropdown = gr.Dropdown(label="Select Your Zodiac Sign", choices=[ "Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces" ]) btn_get_horoscope = gr.Button("Get Horoscope") btn_get_horoscope.click(fn=get_horoscope, inputs=sign_dropdown, outputs=horoscope_output) if __name__ == "__main__": demo.launch()