Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,10 @@ def classify_frame(frame):
|
|
22 |
|
23 |
def process_video(video_file):
|
24 |
result = ""
|
25 |
-
|
|
|
|
|
|
|
26 |
duration = int(video.duration)
|
27 |
frame_interval = duration // 10 # Analyze 10 frames evenly spaced throughout the video
|
28 |
|
|
|
22 |
|
23 |
def process_video(video_file):
|
24 |
result = ""
|
25 |
+
if isinstance(video_file, str): # If the input is a file path
|
26 |
+
video = mp.VideoFileClip(video_file)
|
27 |
+
else: # If the input is a file-like object
|
28 |
+
video = mp.VideoFileClip(io.BytesIO(video_file.read()))
|
29 |
duration = int(video.duration)
|
30 |
frame_interval = duration // 10 # Analyze 10 frames evenly spaced throughout the video
|
31 |
|