felix.wf commited on
Commit
5a6a4e1
·
1 Parent(s): be331fc

update video process

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -188,6 +188,23 @@ if file_name is not None:
188
 
189
  st.pyplot(fig)
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
 
192
  else:
193
  st.error("Unsupported file type. Please upload an image or a video.")
 
188
 
189
  st.pyplot(fig)
190
 
191
+ # Assuming frame_emotions_refined is a list of lists, where each sublist contains emotion labels for a frame
192
+ fig, ax = plt.subplots(figsize=(10, 5))
193
+
194
+ # Iterate over each frame's emotions
195
+ for frame_idx, emotions in enumerate(frame_emotions_refined):
196
+ # Count occurrences of each emotion in the current frame
197
+ emotion_counts = {emotion: emotions.count(emotion) for emotion in set(emotions)}
198
+
199
+ # Plot the emotion counts for the current frame
200
+ ax.clear()
201
+ ax.bar(emotion_counts.keys(), emotion_counts.values())
202
+ ax.set_title(f"Frame {frame_idx + 1}")
203
+ ax.set_xlabel('Emotions')
204
+ ax.set_ylabel('Count')
205
+
206
+ # Display the plot for the current frame
207
+ st.pyplot(fig)
208
 
209
  else:
210
  st.error("Unsupported file type. Please upload an image or a video.")