Spaces:
Running
on
Zero
Running
on
Zero
Revert
Browse files- app_endframe.py +2 -46
app_endframe.py
CHANGED
|
@@ -665,50 +665,6 @@ def worker(input_video, end_frame, end_frame_weight, prompt, n_prompt, seed, bat
|
|
| 665 |
def get_duration(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 |
-
@spaces.GPU(duration=get_duration)
|
| 669 |
-
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):
|
| 670 |
-
global stream, high_vram
|
| 671 |
-
# 20250506 pftq: Updated assertion for video input
|
| 672 |
-
assert input_video is not None, 'No input video!'
|
| 673 |
-
|
| 674 |
-
yield None
|
| 675 |
-
|
| 676 |
-
# 20250507 pftq: Even the H100 needs offloading if the video dimensions are 720p or higher
|
| 677 |
-
if high_vram and (no_resize or resolution>640):
|
| 678 |
-
print("Disabling high vram mode due to no resize and/or potentially higher resolution...")
|
| 679 |
-
high_vram = False
|
| 680 |
-
vae.enable_slicing()
|
| 681 |
-
vae.enable_tiling()
|
| 682 |
-
DynamicSwapInstaller.install_model(transformer, device=gpu)
|
| 683 |
-
DynamicSwapInstaller.install_model(text_encoder, device=gpu)
|
| 684 |
-
|
| 685 |
-
# 20250508 pftq: automatically set distilled cfg to 1 if cfg is used
|
| 686 |
-
if cfg > 1:
|
| 687 |
-
gs = 1
|
| 688 |
-
|
| 689 |
-
stream = AsyncStream()
|
| 690 |
-
|
| 691 |
-
# 20250506 pftq: Pass num_clean_frames, vae_batch, etc
|
| 692 |
-
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)
|
| 693 |
-
|
| 694 |
-
output_filename = None
|
| 695 |
-
|
| 696 |
-
while True:
|
| 697 |
-
flag, data = stream.output_queue.next()
|
| 698 |
-
|
| 699 |
-
if flag == 'file':
|
| 700 |
-
output_filename = data
|
| 701 |
-
yield output_filename
|
| 702 |
-
|
| 703 |
-
if flag == 'progress':
|
| 704 |
-
preview, desc, html = data
|
| 705 |
-
#yield gr.update(), gr.update(visible=True, value=preview), desc, html, gr.update(interactive=False), gr.update(interactive=True)
|
| 706 |
-
yield output_filename
|
| 707 |
-
|
| 708 |
-
if flag == 'end':
|
| 709 |
-
yield output_filename
|
| 710 |
-
break
|
| 711 |
-
|
| 712 |
@spaces.GPU(duration=get_duration)
|
| 713 |
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):
|
| 714 |
global stream, high_vram
|
|
@@ -858,9 +814,9 @@ with block:
|
|
| 858 |
],
|
| 859 |
],
|
| 860 |
run_on_click = True,
|
| 861 |
-
fn =
|
| 862 |
inputs = [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],
|
| 863 |
-
outputs = [result_video],
|
| 864 |
cache_examples = True,
|
| 865 |
)
|
| 866 |
gr.HTML("""
|
|
|
|
| 665 |
def get_duration(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 |
@spaces.GPU(duration=get_duration)
|
| 669 |
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):
|
| 670 |
global stream, high_vram
|
|
|
|
| 814 |
],
|
| 815 |
],
|
| 816 |
run_on_click = True,
|
| 817 |
+
fn = process,
|
| 818 |
inputs = [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],
|
| 819 |
+
outputs = [result_video, preview_image, progress_desc, progress_bar, start_button, end_button],
|
| 820 |
cache_examples = True,
|
| 821 |
)
|
| 822 |
gr.HTML("""
|