felix.wf commited on
Commit
7e8df8d
·
1 Parent(s): 9db8a5d

refine page

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -127,11 +127,11 @@ if file_name is not None:
127
  labels_refined = [item['label'] for item in output_list_emotions_refined]
128
  label_counts_refined = {label: labels_refined.count(label) for label in set(labels_refined)}
129
 
130
- bar_fig, bar_ax = plt.subplots()
131
- bar_ax.bar(label_counts_refined.keys(), label_counts_refined.values())
132
- bar_ax.set_title('Distribution of Emotions')
133
- bar_ax.set_xlabel('Emotions')
134
- bar_ax.set_ylabel('Count')
135
 
136
  labels_emotions = [item['label'] for item in output_list_emotions]
137
  label_counts_emotions = {label: labels_emotions.count(label) for label in set(labels_emotions)}
@@ -147,10 +147,12 @@ if file_name is not None:
147
 
148
  st.pyplot(fig) # Display the stitched person images
149
 
150
- st.pyplot(pie_fig_emotions) # Display the pie chart
151
- st.pyplot(pie_fig_actions) # Display the pie chart
152
- st.pyplot(bar_fig) # Display the bar chart
153
- st.pyplot(bar_fig_emotions) # Display the bar chart
 
 
154
 
155
  elif file_name.type.startswith('video'):
156
  # Save the uploaded video to a temporary file
 
127
  labels_refined = [item['label'] for item in output_list_emotions_refined]
128
  label_counts_refined = {label: labels_refined.count(label) for label in set(labels_refined)}
129
 
130
+ bar_fig_actions, bar_ax_actions = plt.subplots()
131
+ bar_ax_actions.bar(label_counts_refined.keys(), label_counts_refined.values())
132
+ bar_ax_actions.set_title('Distribution of Actions')
133
+ bar_ax_actions.set_xlabel('Emotions')
134
+ bar_ax_actions.set_ylabel('Count')
135
 
136
  labels_emotions = [item['label'] for item in output_list_emotions]
137
  label_counts_emotions = {label: labels_emotions.count(label) for label in set(labels_emotions)}
 
147
 
148
  st.pyplot(fig) # Display the stitched person images
149
 
150
+ col1, col2 = st.columns(2)
151
+ col1.pyplot(pie_fig_emotions) # Display the pie chart
152
+ col2.pyplot(bar_fig_emotions) # Display the bar chart
153
+
154
+ col1.pyplot(pie_fig_actions) # Display the pie chart
155
+ col2.pyplot(bar_fig_actions) # Display the bar chart
156
 
157
  elif file_name.type.startswith('video'):
158
  # Save the uploaded video to a temporary file