Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,6 +26,8 @@ def process_video(video):
|
|
26 |
# List to store processed frames for Gradio output
|
27 |
processed_frames = []
|
28 |
|
|
|
|
|
29 |
while True:
|
30 |
# Read a frame from the video
|
31 |
ret, frame = input_video.read()
|
@@ -49,6 +51,11 @@ def process_video(video):
|
|
49 |
# Append the annotated frame to the list for Gradio
|
50 |
processed_frames.append(annotated_frame_rgb)
|
51 |
|
|
|
|
|
|
|
|
|
|
|
52 |
# Release resources
|
53 |
input_video.release()
|
54 |
|
|
|
26 |
# List to store processed frames for Gradio output
|
27 |
processed_frames = []
|
28 |
|
29 |
+
frame_counter = 0 # Counter to limit the number of frames for processing
|
30 |
+
|
31 |
while True:
|
32 |
# Read a frame from the video
|
33 |
ret, frame = input_video.read()
|
|
|
51 |
# Append the annotated frame to the list for Gradio
|
52 |
processed_frames.append(annotated_frame_rgb)
|
53 |
|
54 |
+
# Limit the number of frames processed (to speed up processing)
|
55 |
+
frame_counter += 1
|
56 |
+
if frame_counter > 100: # Process only 100 frames, adjust as necessary
|
57 |
+
break
|
58 |
+
|
59 |
# Release resources
|
60 |
input_video.release()
|
61 |
|