Beasto commited on
Commit
10f5d90
·
1 Parent(s): 8bcf6d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -6,13 +6,16 @@ import tensorflow as tf
6
  import streamlit as st
7
 
8
  # Open the video file
9
- video_file = st.file_uploader("Choose a video file", type=["mp4"])
10
 
11
  if video_file is not None:
12
  # Read the video file from the file-like object
13
- video_path = video_file.name
14
- video_np = np.frombuffer(video_path,np.uint8)
15
- cap = cv2.imdecode(video_np, cv2.IMREAD_UNCHANGED)
 
 
 
16
 
17
  # Get the frames per second (fps) of the video
18
  fps = (cap.get(cv2.CAP_PROP_FPS))
 
6
  import streamlit as st
7
 
8
  # Open the video file
9
+ f = st.file_uploader("Choose a Video")
10
 
11
  if video_file is not None:
12
  # Read the video file from the file-like object
13
+
14
+ tfile = tempfile.NamedTemporaryFile(delete=False)
15
+ tfile.write(f.read())
16
+
17
+ # Opens the Video file
18
+ cap= cv2.VideoCapture(tfile.name)
19
 
20
  # Get the frames per second (fps) of the video
21
  fps = (cap.get(cv2.CAP_PROP_FPS))