File size: 1,845 Bytes
6b2a4b3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
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()
|