Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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 |
-
|
| 240 |
-
if not
|
| 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
|
| 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)
|