TheKnight115 commited on
Commit
3f85f8f
·
verified ·
1 Parent(s): 8be0123

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -27,9 +27,16 @@ def process_results(results, image):
27
 
28
  return image
29
 
 
 
30
  def process_video(uploaded_file):
 
 
 
 
 
31
  # Read the video file
32
- video = cv2.VideoCapture(uploaded_file)
33
  frames = []
34
 
35
  while True:
@@ -55,6 +62,7 @@ def process_video(uploaded_file):
55
 
56
  out.release()
57
 
 
58
  def main():
59
  st.title("Motorbike Violation Detection")
60
 
 
27
 
28
  return image
29
 
30
+ import tempfile
31
+
32
  def process_video(uploaded_file):
33
+ # Create a temporary file to save the uploaded video
34
+ with tempfile.NamedTemporaryFile(delete=False, suffix='.mp4') as temp_file:
35
+ temp_file.write(uploaded_file.read())
36
+ temp_file_path = temp_file.name # Get the path of the temporary file
37
+
38
  # Read the video file
39
+ video = cv2.VideoCapture(temp_file_path)
40
  frames = []
41
 
42
  while True:
 
62
 
63
  out.release()
64
 
65
+
66
  def main():
67
  st.title("Motorbike Violation Detection")
68