saadlahori commited on
Commit
6b2a4b3
Β·
verified Β·
1 Parent(s): fe68caa

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -0
app.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import random
3
+
4
+ moods = {
5
+ "Happy": {
6
+ "quote": "Happiness is a direction, not a place.",
7
+ "emoji": "πŸ˜„",
8
+ "activity": "Go out for a walk or dance to your favorite song!",
9
+ "song": "🎡 'Happy' by Pharrell Williams"
10
+ },
11
+ "Sad": {
12
+ "quote": "Tears come from the heart and not from the brain.",
13
+ "emoji": "😒",
14
+ "activity": "Watch a feel-good movie or call a friend.",
15
+ "song": "🎡 'Someone Like You' by Adele"
16
+ },
17
+ "Angry": {
18
+ "quote": "For every minute you remain angry, you give up sixty seconds of peace.",
19
+ "emoji": "😑",
20
+ "activity": "Try deep breathing or a short walk.",
21
+ "song": "🎡 'Lose Yourself' by Eminem"
22
+ },
23
+ "Excited": {
24
+ "quote": "The future belongs to those who believe in the beauty of their dreams.",
25
+ "emoji": "🀩",
26
+ "activity": "Start that new project you've been thinking about!",
27
+ "song": "🎡 'Can’t Stop the Feeling!' by Justin Timberlake"
28
+ },
29
+ "Tired": {
30
+ "quote": "Sometimes the most productive thing you can do is rest.",
31
+ "emoji": "😴",
32
+ "activity": "Take a short nap or meditate for 10 minutes.",
33
+ "song": "🎡 'Let It Be' by The Beatles"
34
+ }
35
+ }
36
+
37
+ def mood_respond(mood):
38
+ response = moods.get(mood, {})
39
+ return response.get("quote", ""), response.get("emoji", ""), response.get("activity", ""), response.get("song", "")
40
+
41
+ demo = gr.Interface(
42
+ fn=mood_respond,
43
+ inputs=gr.Radio(list(moods.keys()), label="How are you feeling today?"),
44
+ outputs=[
45
+ gr.Textbox(label="Inspiring Quote"),
46
+ gr.Textbox(label="Emoji"),
47
+ gr.Textbox(label="Suggested Activity"),
48
+ gr.Textbox(label="Recommended Song")
49
+ ],
50
+ title="🌈 AI Mood Generator",
51
+ theme="soft"
52
+ )
53
+
54
+ demo.launch()