Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -54,21 +54,21 @@ if uploaded_image:
|
|
54 |
'Surprise': '#FFA500',
|
55 |
'Fear': '#000000'
|
56 |
}
|
57 |
-
pie_colors = [color_map.get(emotion, '#999999') for emotion in emotion_counts.index]
|
58 |
-
# Pie chart visualization
|
59 |
-
fig_pie, ax_pie = plt.subplots(figsize=(4, 4))
|
60 |
-
ax_pie.pie(emotion_counts, labels=emotion_counts.index, autopct='%1.1f%%', startangle=140, colors=pie_colors)
|
61 |
-
ax_pie.axis('equal')
|
62 |
-
ax_pie.set_title("Emotion Distribution")
|
63 |
-
st.pyplot(fig_pie)
|
64 |
|
65 |
-
# Bar chart visualization
|
66 |
-
fig_bar, ax_bar = plt.subplots(figsize=(4, 4))
|
67 |
-
emotion_counts.plot(kind='bar', color=pie_colors, ax=ax_bar)
|
68 |
-
ax_bar.set_xlabel('Emotion')
|
69 |
-
ax_bar.set_ylabel('Count')
|
70 |
-
ax_bar.set_title("Emotion Count")
|
71 |
-
ax_bar.yaxis.set_major_locator(plt.MaxNLocator(integer=True))
|
72 |
-
for i in ax_bar.patches:
|
73 |
-
|
74 |
-
st.pyplot(fig_bar)
|
|
|
54 |
'Surprise': '#FFA500',
|
55 |
'Fear': '#000000'
|
56 |
}
|
57 |
+
# pie_colors = [color_map.get(emotion, '#999999') for emotion in emotion_counts.index]
|
58 |
+
# # Pie chart visualization
|
59 |
+
# fig_pie, ax_pie = plt.subplots(figsize=(4, 4))
|
60 |
+
# ax_pie.pie(emotion_counts, labels=emotion_counts.index, autopct='%1.1f%%', startangle=140, colors=pie_colors)
|
61 |
+
# ax_pie.axis('equal')
|
62 |
+
# ax_pie.set_title("Emotion Distribution")
|
63 |
+
# st.pyplot(fig_pie)
|
64 |
|
65 |
+
# # Bar chart visualization
|
66 |
+
# fig_bar, ax_bar = plt.subplots(figsize=(4, 4))
|
67 |
+
# emotion_counts.plot(kind='bar', color=pie_colors, ax=ax_bar)
|
68 |
+
# ax_bar.set_xlabel('Emotion')
|
69 |
+
# ax_bar.set_ylabel('Count')
|
70 |
+
# ax_bar.set_title("Emotion Count")
|
71 |
+
# ax_bar.yaxis.set_major_locator(plt.MaxNLocator(integer=True))
|
72 |
+
# for i in ax_bar.patches:
|
73 |
+
# ax_bar.text(i.get_x() + i.get_width() / 2, i.get_height() + 0.1, str(int(i.get_height())), ha='center', va='bottom')
|
74 |
+
# st.pyplot(fig_bar)
|