xtlyxt commited on
Commit
8f9b3cd
·
verified ·
1 Parent(s): 3c9434b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -107,6 +107,9 @@ if st.button("Predict Emotions") and selected_images:
107
  # Plot pie chart with total faces in the title
108
  st.write("Emotion Distribution (Pie Chart):")
109
  fig_pie, ax_pie = plt.subplots()
 
 
 
110
  ax_pie.pie(emotion_counts, labels=emotion_counts.index, autopct='%1.1f%%', startangle=140, colors=pie_colors)
111
  ax_pie.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
112
  # Add total faces to the title
@@ -125,4 +128,8 @@ if st.button("Predict Emotions") and selected_images:
125
  # Add total faces to the title
126
  ax_bar.set_title(f"Emotion Distribution - Total Faces Analyzed: {total_faces}")
127
  ax_bar.yaxis.set_major_locator(plt.MaxNLocator(integer=True)) # Ensure integer ticks on Y-axis
 
 
 
 
128
  st.pyplot(fig_bar)
 
107
  # Plot pie chart with total faces in the title
108
  st.write("Emotion Distribution (Pie Chart):")
109
  fig_pie, ax_pie = plt.subplots()
110
+ #font color
111
+ ax_pie.pie(emotion_counts, labels=emotion_counts.index, autopct='%1.1f%%', startangle=140, colors=pie_colors, textprops={'color': 'white', 'weight': 'bold'})
112
+
113
  ax_pie.pie(emotion_counts, labels=emotion_counts.index, autopct='%1.1f%%', startangle=140, colors=pie_colors)
114
  ax_pie.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
115
  # Add total faces to the title
 
128
  # Add total faces to the title
129
  ax_bar.set_title(f"Emotion Distribution - Total Faces Analyzed: {total_faces}")
130
  ax_bar.yaxis.set_major_locator(plt.MaxNLocator(integer=True)) # Ensure integer ticks on Y-axis
131
+ # Display bar values as integers
132
+ for i in ax_bar.patches:
133
+ ax_bar.text(i.get_x() + i.get_width() / 2, i.get_height() + 0.1, int(i.get_height()), ha='center', va='bottom')
134
+
135
  st.pyplot(fig_bar)