yield None
Browse files- app_endframe.py +41 -2
app_endframe.py
CHANGED
|
@@ -666,8 +666,47 @@ def get_duration(input_video, end_frame, end_frame_weight, prompt, n_prompt, see
|
|
| 666 |
return total_second_length * 60
|
| 667 |
|
| 668 |
def process_example(input_video, end_frame, end_frame_weight, prompt, n_prompt, seed, batch, resolution, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, no_resize, mp4_crf, num_clean_frames, vae_batch):
|
| 669 |
-
|
| 670 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 671 |
|
| 672 |
@spaces.GPU(duration=get_duration)
|
| 673 |
def process(input_video, end_frame, end_frame_weight, prompt, n_prompt, seed, batch, resolution, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, no_resize, mp4_crf, num_clean_frames, vae_batch):
|
|
|
|
| 666 |
return total_second_length * 60
|
| 667 |
|
| 668 |
def process_example(input_video, end_frame, end_frame_weight, prompt, n_prompt, seed, batch, resolution, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, no_resize, mp4_crf, num_clean_frames, vae_batch):
|
| 669 |
+
global stream, high_vram
|
| 670 |
+
# 20250506 pftq: Updated assertion for video input
|
| 671 |
+
assert input_video is not None, 'No input video!'
|
| 672 |
+
|
| 673 |
+
yield None
|
| 674 |
+
|
| 675 |
+
# 20250507 pftq: Even the H100 needs offloading if the video dimensions are 720p or higher
|
| 676 |
+
if high_vram and (no_resize or resolution>640):
|
| 677 |
+
print("Disabling high vram mode due to no resize and/or potentially higher resolution...")
|
| 678 |
+
high_vram = False
|
| 679 |
+
vae.enable_slicing()
|
| 680 |
+
vae.enable_tiling()
|
| 681 |
+
DynamicSwapInstaller.install_model(transformer, device=gpu)
|
| 682 |
+
DynamicSwapInstaller.install_model(text_encoder, device=gpu)
|
| 683 |
+
|
| 684 |
+
# 20250508 pftq: automatically set distilled cfg to 1 if cfg is used
|
| 685 |
+
if cfg > 1:
|
| 686 |
+
gs = 1
|
| 687 |
+
|
| 688 |
+
stream = AsyncStream()
|
| 689 |
+
|
| 690 |
+
# 20250506 pftq: Pass num_clean_frames, vae_batch, etc
|
| 691 |
+
async_run(worker, input_video, end_frame, end_frame_weight, prompt, n_prompt, seed, batch, resolution, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, no_resize, mp4_crf, num_clean_frames, vae_batch)
|
| 692 |
+
|
| 693 |
+
output_filename = None
|
| 694 |
+
|
| 695 |
+
while True:
|
| 696 |
+
flag, data = stream.output_queue.next()
|
| 697 |
+
|
| 698 |
+
if flag == 'file':
|
| 699 |
+
output_filename = data
|
| 700 |
+
yield output_filename
|
| 701 |
+
|
| 702 |
+
if flag == 'progress':
|
| 703 |
+
preview, desc, html = data
|
| 704 |
+
#yield gr.update(), gr.update(visible=True, value=preview), desc, html, gr.update(interactive=False), gr.update(interactive=True)
|
| 705 |
+
yield output_filename
|
| 706 |
+
|
| 707 |
+
if flag == 'end':
|
| 708 |
+
yield output_filename
|
| 709 |
+
break
|
| 710 |
|
| 711 |
@spaces.GPU(duration=get_duration)
|
| 712 |
def process(input_video, end_frame, end_frame_weight, prompt, n_prompt, seed, batch, resolution, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, no_resize, mp4_crf, num_clean_frames, vae_batch):
|