storresbusquets commited on
Commit
b6bf8ab
Β·
1 Parent(s): 6100c94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -223,9 +223,20 @@ class GradioInference:
223
  formatted_keywords = "\n".join([f"β€’ {keyword}" for keyword in keywords])
224
 
225
  progress(0.80, desc="Extracting Sentiment")
 
 
 
 
 
 
 
 
226
  # Sentiment label
227
  label = self.classifier(summary)[0]["label"]
228
 
 
 
 
229
  progress(0.90, desc="Generating Wordcloud")
230
  # WordCloud object
231
  wordcloud = WordCloud(colormap = "Oranges").generate(
@@ -238,7 +249,7 @@ class GradioInference:
238
  results["text"],
239
  transcription_summary[0]["summary_text"],
240
  formatted_keywords,
241
- label,
242
  wordcloud_image,
243
  )
244
  else:
@@ -246,7 +257,7 @@ class GradioInference:
246
  results["text"],
247
  summary,
248
  formatted_keywords,
249
- label,
250
  wordcloud_image,
251
  )
252
 
 
223
  formatted_keywords = "\n".join([f"β€’ {keyword}" for keyword in keywords])
224
 
225
  progress(0.80, desc="Extracting Sentiment")
226
+
227
+ # Define a dictionary to map labels to emojis
228
+ sentiment_emojis = {
229
+ "positive": "Positive πŸ‘πŸΌ",
230
+ "negative": "Negative πŸ‘ŽπŸΌ",
231
+ "neutral": "Neutral 😢",
232
+ }
233
+
234
  # Sentiment label
235
  label = self.classifier(summary)[0]["label"]
236
 
237
+ # Format the label with emojis
238
+ formatted_sentiment = sentiment_emojis.get(label, label)
239
+
240
  progress(0.90, desc="Generating Wordcloud")
241
  # WordCloud object
242
  wordcloud = WordCloud(colormap = "Oranges").generate(
 
249
  results["text"],
250
  transcription_summary[0]["summary_text"],
251
  formatted_keywords,
252
+ formatted_sentiment,
253
  wordcloud_image,
254
  )
255
  else:
 
257
  results["text"],
258
  summary,
259
  formatted_keywords,
260
+ formatted_sentiment,
261
  wordcloud_image,
262
  )
263