Saadmirza12 commited on
Commit
9b51f32
Β·
verified Β·
1 Parent(s): 1675915

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def mood_detector(text):
4
+ text = text.lower()
5
+ if any(word in text for word in ["happy", "great", "awesome", "joy", "love"]):
6
+ return "😊 Happy"
7
+ elif any(word in text for word in ["sad", "tired", "upset", "cry"]):
8
+ return "😒 Sad"
9
+ elif any(word in text for word in ["angry", "mad", "furious"]):
10
+ return "😑 Angry"
11
+ elif any(word in text for word in ["bored", "meh", "nothing"]):
12
+ return "😐 Bored"
13
+ else:
14
+ return "πŸ€” Not sure"
15
+
16
+ demo = gr.Interface(
17
+ fn=mood_detector,
18
+ inputs=gr.Textbox(lines=2, placeholder="How are you feeling today?"),
19
+ outputs="text",
20
+ title="AI Emoji Mood Detector 🧠",
21
+ description="Enter how you're feeling and get a mood emoji!"
22
+ )
23
+
24
+ demo.launch()