Spaces:
Sleeping
Sleeping
kovacsvi
commited on
Commit
·
c64e0a4
1
Parent(s):
18797a3
ermm
Browse files
app.py
CHANGED
|
@@ -176,23 +176,17 @@ def plot_average_emotion_barplot(heatmap_data):
|
|
| 176 |
labels = [id2label[i] for i in range(len(mean_scores))]
|
| 177 |
scores = mean_scores
|
| 178 |
|
| 179 |
-
|
| 180 |
-
sorted_data = sorted(
|
| 181 |
-
zip(labels_filtered, scores), key=lambda x: x[1], reverse=True
|
| 182 |
-
)
|
| 183 |
-
sorted_labels, sorted_scores = zip(*sorted_data)
|
| 184 |
-
|
| 185 |
-
colors = [emotion_colors[label] for label in sorted_labels]
|
| 186 |
|
| 187 |
fig, ax = plt.subplots(figsize=(8, 6))
|
| 188 |
bars = sns.barplot(
|
| 189 |
-
x=list(
|
| 190 |
)
|
| 191 |
|
| 192 |
ax.xaxis.set_major_formatter(PercentFormatter(xmax=1.0, decimals=0))
|
| 193 |
|
| 194 |
# Add percentage labels
|
| 195 |
-
for i, score in enumerate(
|
| 196 |
ax.text(score + 0.01, i, f"{score*100:.1f}%", va="center")
|
| 197 |
|
| 198 |
ax.set_title("Average Emotion Confidence Across Sentences", fontsize=14)
|
|
|
|
| 176 |
labels = [id2label[i] for i in range(len(mean_scores))]
|
| 177 |
scores = mean_scores
|
| 178 |
|
| 179 |
+
colors = [emotion_colors[label] for label in labels]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
fig, ax = plt.subplots(figsize=(8, 6))
|
| 182 |
bars = sns.barplot(
|
| 183 |
+
x=list(scores), y=list(labels), palette=colors, ax=ax
|
| 184 |
)
|
| 185 |
|
| 186 |
ax.xaxis.set_major_formatter(PercentFormatter(xmax=1.0, decimals=0))
|
| 187 |
|
| 188 |
# Add percentage labels
|
| 189 |
+
for i, score in enumerate(scores):
|
| 190 |
ax.text(score + 0.01, i, f"{score*100:.1f}%", va="center")
|
| 191 |
|
| 192 |
ax.set_title("Average Emotion Confidence Across Sentences", fontsize=14)
|