File size: 774 Bytes
9b51f32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr

def mood_detector(text):
    text = text.lower()
    if any(word in text for word in ["happy", "great", "awesome", "joy", "love"]):
        return "😊 Happy"
    elif any(word in text for word in ["sad", "tired", "upset", "cry"]):
        return "😒 Sad"
    elif any(word in text for word in ["angry", "mad", "furious"]):
        return "😑 Angry"
    elif any(word in text for word in ["bored", "meh", "nothing"]):
        return "😐 Bored"
    else:
        return "πŸ€” Not sure"

demo = gr.Interface(
    fn=mood_detector,
    inputs=gr.Textbox(lines=2, placeholder="How are you feeling today?"),
    outputs="text",
    title="AI Emoji Mood Detector 🧠",
    description="Enter how you're feeling and get a mood emoji!"
)

demo.launch()