pavan2606 commited on
Commit
95a2b65
โ€ข
1 Parent(s): d71c6e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +62 -2
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
- text_model = gr.Interface(fn=classify_emotion, inputs="textbox", outputs="textbox")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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