baohuynhbk14 commited on
Commit
99d003b
·
verified ·
1 Parent(s): 706937a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -236,13 +236,13 @@ def generate_video(model_name: str, text: str, video_path: str,
236
  if video_path is None:
237
  yield "Please upload a video.", "Please upload a video."
238
  return
239
- frames_with_ts = downsample_video(video_path)
240
- if not frames_with_ts:
241
  yield "Could not process video.", "Could not process video."
242
  return
243
  messages = [{"role": "user", "content": [{"type": "text", "text": text}]}]
244
  images_for_processor = []
245
- for frame, timestamp in frames_with_ts:
246
  messages[0]["content"].append({"type": "image"})
247
  images_for_processor.append(frame)
248
  prompt_full = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
 
236
  if video_path is None:
237
  yield "Please upload a video.", "Please upload a video."
238
  return
239
+ frames = downsample_video(video_path)
240
+ if not frames:
241
  yield "Could not process video.", "Could not process video."
242
  return
243
  messages = [{"role": "user", "content": [{"type": "text", "text": text}]}]
244
  images_for_processor = []
245
+ for frame in frames:
246
  messages[0]["content"].append({"type": "image"})
247
  images_for_processor.append(frame)
248
  prompt_full = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)