Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -28,15 +28,18 @@ h3 { | |
| 28 | 
             
            }
         | 
| 29 | 
             
            """
         | 
| 30 |  | 
| 31 | 
            -
             | 
|  | |
| 32 |  | 
| 33 | 
            -
            # Horoscope Function with  | 
| 34 | 
             
            def get_horoscope(sign):
         | 
| 35 | 
             
                try:
         | 
| 36 | 
            -
                     | 
| 37 | 
            -
                    response. | 
|  | |
| 38 | 
             
                    data = response.json()
         | 
| 39 | 
            -
                     | 
|  | |
| 40 | 
             
                except requests.exceptions.RequestException:
         | 
| 41 | 
             
                    return "<div class='card'>Error retrieving horoscope. Please try again later.</div>"
         | 
| 42 |  | 
| @@ -46,11 +49,10 @@ with gr.Blocks(theme="soft", css=CSS) as demo: | |
| 46 | 
             
                gr.Markdown("### Get your daily horoscope.")
         | 
| 47 | 
             
                horoscope_output = gr.HTML()  # Retains the HTML formatting for horoscopes
         | 
| 48 | 
             
                sign_dropdown = gr.Dropdown(label="Select Your Zodiac Sign", choices=[
         | 
| 49 | 
            -
                    " | 
| 50 | 
             
                ])
         | 
| 51 | 
             
                btn_get_horoscope = gr.Button("Get Horoscope")
         | 
| 52 |  | 
| 53 | 
             
                btn_get_horoscope.click(fn=get_horoscope, inputs=sign_dropdown, outputs=horoscope_output)
         | 
| 54 |  | 
| 55 | 
            -
            if  | 
| 56 | 
            -
                demo.launch(server_name='0.0.0.0')
         | 
|  | |
| 28 | 
             
            }
         | 
| 29 | 
             
            """
         | 
| 30 |  | 
| 31 | 
            +
            # New Horoscope API URL (Aztro)
         | 
| 32 | 
            +
            AZTRO_API_URL = "https://aztro.sameerkumar.website"
         | 
| 33 |  | 
| 34 | 
            +
            # Horoscope Function with the Aztro API
         | 
| 35 | 
             
            def get_horoscope(sign):
         | 
| 36 | 
             
                try:
         | 
| 37 | 
            +
                    # Send a POST request with the sign as a parameter
         | 
| 38 | 
            +
                    response = requests.post(f"{AZTRO_API_URL}/?sign={sign}&day=today")
         | 
| 39 | 
            +
                    response.raise_for_status()
         | 
| 40 | 
             
                    data = response.json()
         | 
| 41 | 
            +
                    # Return the horoscope description
         | 
| 42 | 
            +
                    return f"<div class='card'>{data.get('description', 'No horoscope available for today.')}</div>"
         | 
| 43 | 
             
                except requests.exceptions.RequestException:
         | 
| 44 | 
             
                    return "<div class='card'>Error retrieving horoscope. Please try again later.</div>"
         | 
| 45 |  | 
|  | |
| 49 | 
             
                gr.Markdown("### Get your daily horoscope.")
         | 
| 50 | 
             
                horoscope_output = gr.HTML()  # Retains the HTML formatting for horoscopes
         | 
| 51 | 
             
                sign_dropdown = gr.Dropdown(label="Select Your Zodiac Sign", choices=[
         | 
| 52 | 
            +
                    "aries", "taurus", "gemini", "cancer", "leo", "virgo", "libra", "scorpio", "sagittarius", "capricorn", "aquarius", "pisces"
         | 
| 53 | 
             
                ])
         | 
| 54 | 
             
                btn_get_horoscope = gr.Button("Get Horoscope")
         | 
| 55 |  | 
| 56 | 
             
                btn_get_horoscope.click(fn=get_horoscope, inputs=sign_dropdown, outputs=horoscope_output)
         | 
| 57 |  | 
| 58 | 
            +
            if _
         | 
|  | 
