Spaces:
Runtime error
Runtime error
storresbusquets
commited on
Commit
Β·
e41cc61
1
Parent(s):
b6bf8ab
Update app.py
Browse files
app.py
CHANGED
@@ -119,9 +119,20 @@ class GradioInference:
|
|
119 |
formatted_keywords = "\n".join([f"β’ {keyword}" for keyword in keywords])
|
120 |
|
121 |
progress(0.80, desc="Extracting Sentiment")
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
label = self.classifier(summary)[0]["label"]
|
124 |
|
|
|
|
|
|
|
125 |
progress(0.90, desc="Generating Wordcloud")
|
126 |
# Generate WordCloud object
|
127 |
wordcloud = WordCloud(colormap = "Oranges").generate(results["text"])
|
@@ -134,7 +145,7 @@ class GradioInference:
|
|
134 |
results["text"],
|
135 |
transcription_summary[0]["summary_text"],
|
136 |
formatted_keywords,
|
137 |
-
|
138 |
wordcloud_image,
|
139 |
)
|
140 |
else:
|
@@ -142,7 +153,7 @@ class GradioInference:
|
|
142 |
results["text"],
|
143 |
summary,
|
144 |
formatted_keywords,
|
145 |
-
|
146 |
wordcloud_image,
|
147 |
)
|
148 |
|
|
|
119 |
formatted_keywords = "\n".join([f"β’ {keyword}" for keyword in keywords])
|
120 |
|
121 |
progress(0.80, desc="Extracting Sentiment")
|
122 |
+
|
123 |
+
# Define a dictionary to map labels to emojis
|
124 |
+
sentiment_emojis = {
|
125 |
+
"positive": "Positive ππΌ",
|
126 |
+
"negative": "Negative ππΌ",
|
127 |
+
"neutral": "Neutral πΆ",
|
128 |
+
}
|
129 |
+
|
130 |
+
# Sentiment label
|
131 |
label = self.classifier(summary)[0]["label"]
|
132 |
|
133 |
+
# Format the label with emojis
|
134 |
+
formatted_sentiment = sentiment_emojis.get(label, label)
|
135 |
+
|
136 |
progress(0.90, desc="Generating Wordcloud")
|
137 |
# Generate WordCloud object
|
138 |
wordcloud = WordCloud(colormap = "Oranges").generate(results["text"])
|
|
|
145 |
results["text"],
|
146 |
transcription_summary[0]["summary_text"],
|
147 |
formatted_keywords,
|
148 |
+
formatted_sentiment,
|
149 |
wordcloud_image,
|
150 |
)
|
151 |
else:
|
|
|
153 |
results["text"],
|
154 |
summary,
|
155 |
formatted_keywords,
|
156 |
+
formatted_sentiment,
|
157 |
wordcloud_image,
|
158 |
)
|
159 |
|