RCaz commited on
Commit
aabba29
·
1 Parent(s): d347385

check extraction ok

Browse files
Files changed (2) hide show
  1. app.py +4 -5
  2. utils.py +1 -0
app.py CHANGED
@@ -12,15 +12,14 @@ def answer_video_question(query : str, url : str, file : bytes) -> dict:
12
  temp_video_path = temp_vid.name
13
 
14
  # Output frame folder
15
- frame_output_path = './cache/uploaded_video/frames'
16
- extract_keyframes(temp_video_path)
17
 
18
- return {"out_vid_frame_from_file":frame_output_path}
19
 
20
  elif url:
21
  files_path = download_video(url)
22
- extract_keyframes(files_path['video_path'])
23
- return {"out_vid_path_from_url":}
24
 
25
  else:
26
  return {"error": "Please provide a movie file or URL."}
 
12
  temp_video_path = temp_vid.name
13
 
14
  # Output frame folder
15
+ check = extract_keyframes(temp_video_path)
 
16
 
17
+ return {"status_vid_frame_from_file":check}
18
 
19
  elif url:
20
  files_path = download_video(url)
21
+ check = extract_keyframes(files_path['video_path'])
22
+ return {"out_vid_path_from_url":check}
23
 
24
  else:
25
  return {"error": "Please provide a movie file or URL."}
utils.py CHANGED
@@ -122,6 +122,7 @@ def extract_keyframes(video_path, diff_threshold=0.4):
122
 
123
  cap.release()
124
  print(f"Extracted {saved_id} key frames.")
 
125
 
126
  # Example usage
127
  extract_keyframes(video_path)
 
122
 
123
  cap.release()
124
  print(f"Extracted {saved_id} key frames.")
125
+ return "success"
126
 
127
  # Example usage
128
  extract_keyframes(video_path)