Spaces:
Runtime error
Runtime error
Updated pages/2_ ⬆️_Upload_Video.py
Browse files
pages/2_ ⬆️_Upload_Video.py
CHANGED
|
@@ -65,6 +65,7 @@ if up_file and uploaded:
|
|
| 65 |
tfile.write(up_file.read())
|
| 66 |
|
| 67 |
vf = cv2.VideoCapture(tfile.name)
|
|
|
|
| 68 |
|
| 69 |
# --------------------- Write the processed video frame. --------------------
|
| 70 |
fps = int(vf.get(cv2.CAP_PROP_FPS))
|
|
@@ -79,14 +80,11 @@ if up_file and uploaded:
|
|
| 79 |
txt = st.sidebar.markdown(ip_vid_str, unsafe_allow_html=True)
|
| 80 |
ip_video = st.sidebar.video(tfile.name)
|
| 81 |
|
| 82 |
-
|
| 83 |
-
ret, frame = vf.read()
|
| 84 |
-
if not ret:
|
| 85 |
-
break
|
| 86 |
|
| 87 |
# convert frame from BGR to RGB before processing it.
|
| 88 |
-
|
| 89 |
-
out_frame, _ = upload_process_frame.process(
|
| 90 |
stframe.image(out_frame)
|
| 91 |
video_output.write(out_frame[...,::-1])
|
| 92 |
|
|
|
|
| 65 |
tfile.write(up_file.read())
|
| 66 |
|
| 67 |
vf = cv2.VideoCapture(tfile.name)
|
| 68 |
+
vf_av = av.open(tfile.name)
|
| 69 |
|
| 70 |
# --------------------- Write the processed video frame. --------------------
|
| 71 |
fps = int(vf.get(cv2.CAP_PROP_FPS))
|
|
|
|
| 80 |
txt = st.sidebar.markdown(ip_vid_str, unsafe_allow_html=True)
|
| 81 |
ip_video = st.sidebar.video(tfile.name)
|
| 82 |
|
| 83 |
+
for frame in vf_av.decode(video=0):
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
# convert frame from BGR to RGB before processing it.
|
| 86 |
+
frame_rgb = frame.to_ndarray(format="rgb24")
|
| 87 |
+
out_frame, _ = upload_process_frame.process(frame_rgb, pose)
|
| 88 |
stframe.image(out_frame)
|
| 89 |
video_output.write(out_frame[...,::-1])
|
| 90 |
|