import gradio as gr import random moods = { "Happy": { "quote": "Happiness is a direction, not a place.", "emoji": "πŸ˜„", "activity": "Go out for a walk or dance to your favorite song!", "song": "🎡 'Happy' by Pharrell Williams" }, "Sad": { "quote": "Tears come from the heart and not from the brain.", "emoji": "😒", "activity": "Watch a feel-good movie or call a friend.", "song": "🎡 'Someone Like You' by Adele" }, "Angry": { "quote": "For every minute you remain angry, you give up sixty seconds of peace.", "emoji": "😑", "activity": "Try deep breathing or a short walk.", "song": "🎡 'Lose Yourself' by Eminem" }, "Excited": { "quote": "The future belongs to those who believe in the beauty of their dreams.", "emoji": "🀩", "activity": "Start that new project you've been thinking about!", "song": "🎡 'Can’t Stop the Feeling!' by Justin Timberlake" }, "Tired": { "quote": "Sometimes the most productive thing you can do is rest.", "emoji": "😴", "activity": "Take a short nap or meditate for 10 minutes.", "song": "🎡 'Let It Be' by The Beatles" } } def mood_respond(mood): response = moods.get(mood, {}) return response.get("quote", ""), response.get("emoji", ""), response.get("activity", ""), response.get("song", "") demo = gr.Interface( fn=mood_respond, inputs=gr.Radio(list(moods.keys()), label="How are you feeling today?"), outputs=[ gr.Textbox(label="Inspiring Quote"), gr.Textbox(label="Emoji"), gr.Textbox(label="Suggested Activity"), gr.Textbox(label="Recommended Song") ], title="🌈 AI Mood Generator", theme="soft" ) demo.launch()