MNGames commited on
Commit
63c2d6e
·
verified ·
1 Parent(s): fc2b4cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -22,7 +22,10 @@ def classify_frame(frame):
22
 
23
  def process_video(video_file):
24
  result = ""
25
- video = mp.VideoFileClip(io.BytesIO(video_file.read()))
 
 
 
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