Spaces:
Sleeping
Sleeping
vickeee465
commited on
Commit
·
aba39cd
1
Parent(s):
8deb410
plot emotions with 0 frequency
Browse files
app.py
CHANGED
@@ -101,7 +101,8 @@ def plot_emotion_heatmap(heatmap_data):
|
|
101 |
def plot_emotion_barplot(heatmap_data):
|
102 |
most_probable_emotions = heatmap_data.idxmax(axis=0)
|
103 |
emotion_counts = most_probable_emotions.value_counts()
|
104 |
-
|
|
|
105 |
fig, ax = plt.subplots(figsize=(8, 6))
|
106 |
sns.barplot(x=emotion_frequencies.values, y=emotion_frequencies.index, palette="coolwarm", ax=ax)
|
107 |
ax.set_title("Relative Frequencies of Most Probable Emotions")
|
|
|
101 |
def plot_emotion_barplot(heatmap_data):
|
102 |
most_probable_emotions = heatmap_data.idxmax(axis=0)
|
103 |
emotion_counts = most_probable_emotions.value_counts()
|
104 |
+
all_emotions = heatmap_data.index
|
105 |
+
emotion_frequencies = (emotion_counts.reindex(all_emotions, fill_value=0) / emotion_counts.sum()).sort_values(ascending=False)
|
106 |
fig, ax = plt.subplots(figsize=(8, 6))
|
107 |
sns.barplot(x=emotion_frequencies.values, y=emotion_frequencies.index, palette="coolwarm", ax=ax)
|
108 |
ax.set_title("Relative Frequencies of Most Probable Emotions")
|