(
prompt,
image_input,
video_input,
video_strength,
seed_value,
scale_status,
rife_status,
progress=gr.Progress(track_tqdm=True)
)
| 423 | """) |
| 424 | |
| 425 | def generate( |
| 426 | prompt, |
| 427 | image_input, |
| 428 | video_input, |
| 429 | video_strength, |
| 430 | seed_value, |
| 431 | scale_status, |
| 432 | rife_status, |
| 433 | progress=gr.Progress(track_tqdm=True) |
| 434 | ): |
| 435 | latents, seed = infer( |
| 436 | prompt, |
| 437 | image_input, |
| 438 | video_input, |
| 439 | video_strength, |
| 440 | num_inference_steps=50, # NOT Changed |
| 441 | guidance_scale=7.0, # NOT Changed |
| 442 | seed=seed_value, |
| 443 | progress=progress, |
| 444 | ) |
| 445 | if scale_status: |
| 446 | latents = utils.upscale_batch_and_concatenate(upscale_model, latents, device) |
| 447 | if rife_status: |
| 448 | latents = rife_inference_with_latents(frame_interpolation_model, latents) |
| 449 | |
| 450 | batch_size = latents.shape[0] |
| 451 | batch_video_frames = [] |
| 452 | for batch_idx in range(batch_size): |
| 453 | pt_image = latents[batch_idx] |
| 454 | pt_image = torch.stack([pt_image[i] for i in range(pt_image.shape[0])]) |
| 455 | |
| 456 | image_np = VaeImageProcessor.pt_to_numpy(pt_image) |
| 457 | image_pil = VaeImageProcessor.numpy_to_pil(image_np) |
| 458 | batch_video_frames.append(image_pil) |
| 459 | |
| 460 | video_path = utils.save_video(batch_video_frames[0], fps=math.ceil((len(batch_video_frames[0]) - 1) / 6)) |
| 461 | video_update = gr.update(visible=True, value=video_path) |
| 462 | gif_path = convert_to_gif(video_path) |
| 463 | gif_update = gr.update(visible=True, value=gif_path) |
| 464 | seed_update = gr.update(visible=True, value=seed) |
| 465 | |
| 466 | return video_path, video_update, gif_update, seed_update |
| 467 | |
| 468 | def enhance_prompt_func(prompt): |
| 469 | return convert_prompt(prompt, retry_times=1) |
nothing calls this directly
no test coverage detected