Update app.py
Browse files
app.py
CHANGED
@@ -53,7 +53,7 @@ enable_queue=True
|
|
53 |
examples = ["happy1.jpg","happy2.jpeg","netural.jpg","sad.jpeg","surprise.jpeg"]
|
54 |
|
55 |
image_mode=gr.Interface(fn = predict,
|
56 |
-
inputs = gr.Image( image_mode='L'),
|
57 |
outputs = [gr.Label(label='Emotion')], #gr.Label(),
|
58 |
title = title,
|
59 |
examples = examples,
|
@@ -91,7 +91,67 @@ def classify_emotion(text):
|
|
91 |
return output_text
|
92 |
|
93 |
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
|
97 |
|
|
|
53 |
examples = ["happy1.jpg","happy2.jpeg","netural.jpg","sad.jpeg","surprise.jpeg"]
|
54 |
|
55 |
image_mode=gr.Interface(fn = predict,
|
56 |
+
inputs = gr.Image( image_mode='L',label='Image'),
|
57 |
outputs = [gr.Label(label='Emotion')], #gr.Label(),
|
58 |
title = title,
|
59 |
examples = examples,
|
|
|
91 |
return output_text
|
92 |
|
93 |
|
94 |
+
|
95 |
+
|
96 |
+
# Gradio
|
97 |
+
text_title = "Text Emotion Detector"
|
98 |
+
|
99 |
+
text_description = gr.Markdown(
|
100 |
+
"""# Text Emotion Detector: The Mood Meter ๐๐คจ๐
|
101 |
+
|
102 |
+
## Introduction
|
103 |
+
Welcome to our Text Emotion Detector, also known as The Mood Meter! ๐ญ This nifty tool helps you decipher the emotional rollercoaster hidden within any piece of text. Whether it's an enthusiastic rave, a stone-cold report, or a fiery rant, we'll break it down into three simple categories: positive, neutral, or negative vibes. Let's have some fun with words! ๐
|
104 |
+
|
105 |
+
## How It Works
|
106 |
+
Our Mood Meter uses top-notch text analysis wizardry to understand the feels behind your words. We've trained it on mountains of text data and equipped it with cutting-edge algorithms to accurately predict whether your text is partying in positivity, chilling in neutrality, or burning with negativity. ๐ฅ
|
107 |
+
|
108 |
+
|
109 |
+
## Usage: Let's Play the Sentiment Game! ๐ฎ๐
|
110 |
+
|
111 |
+
1. Type your text into the "Mood-o-Matic" text box. Bonus points for creativity! Remember, the weirder, the better! ๐คช
|
112 |
+
2. Summon the Mood Genie by clicking the "Submit" button. Watch out for the magical sparkles! โจโจ
|
113 |
+
3. Hold onto your hats (or tiaras) as the Mood-o-Matic works its mojo and reveals the sentiment verdict. Will it be sunshine and rainbows, or thunderclouds and lightning bolts? โกโ๏ธ
|
114 |
+
4. React accordingly: If it's positive, do a happy dance worthy of a TikTok trend. If it's neutral, give a nonchalant nod like a cool cat. And if it's negative, let out a dramatic gasp that could rival a soap opera cliffhanger. Let's embrace the theatrics of sentiment analysis! ๐ญ
|
115 |
+
|
116 |
+
Now, who said sentiment analysis couldn't be the highlight of your day? Let's turn those words into a mood-boosting adventure! ๐""").value
|
117 |
+
|
118 |
+
text_article = gr.Markdown(
|
119 |
+
"""
|
120 |
+
## Premise
|
121 |
+
We believe that understanding text sentiment shouldn't be dull. It's about diving into the sea of human expression and surfacing with a smile (or a frown, depending on the text). Our Mood Meter is here to make sentiment analysis a delightful journey. ๐
|
122 |
+
|
123 |
+
## Data
|
124 |
+
Our Mood Meter has gobbled up datasets filled with everything from Shakespearean sonnets to social media rants. We've trained it to handle diverse dialects, and writing styles. Because emotions don't stick to a script, and neither do we! ๐
|
125 |
+
|
126 |
+
## Disclaimer
|
127 |
+
While The Mood Meter aims to tickle your funny bone while analyzing sentiment, remember that text analysis is an art, not an exact science. Take our results with a sprinkle of salt (or confetti) and always trust your gut (or your funny bone). ๐โจ
|
128 |
+
""").value
|
129 |
+
|
130 |
+
enable_queue=True
|
131 |
+
|
132 |
+
|
133 |
+
text_examples=[
|
134 |
+
|
135 |
+
"I aced my exam and received praise from my teacher for my hard work.",
|
136 |
+
"I just got a promotion at work, and I'm feeling on top of the world!",
|
137 |
+
"The sudden change in weather surprised everyone, but it didn't cause any inconvenience.",
|
138 |
+
"I accidentally spilled coffee on my laptop, causing it to malfunction.",
|
139 |
+
"I burnt my dinner while trying out a new recipe, and now I have nothing to eat."
|
140 |
+
|
141 |
+
]
|
142 |
+
|
143 |
+
|
144 |
+
text_model=gr.Interface(fn = classify_emotion,
|
145 |
+
inputs = gr.Textbox( label='Text'),
|
146 |
+
outputs = [gr.Textbox(label='Emotion')],
|
147 |
+
title = text_title,
|
148 |
+
examples = text_examples,
|
149 |
+
description = text_description,
|
150 |
+
article=text_article,
|
151 |
+
allow_flagging='never')
|
152 |
+
|
153 |
+
|
154 |
+
|
155 |
|
156 |
|
157 |
|