Spaces:
Sleeping
Sleeping
Create app.py
Browse files
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()
|