Spaces:
Runtime error
Runtime error
Debug
Browse files- app_endframe.py +43 -4
app_endframe.py
CHANGED
|
@@ -107,6 +107,9 @@ stream = AsyncStream()
|
|
| 107 |
outputs_folder = './outputs/'
|
| 108 |
os.makedirs(outputs_folder, exist_ok=True)
|
| 109 |
|
|
|
|
|
|
|
|
|
|
| 110 |
# 20250506 pftq: Added function to encode input video frames into latents
|
| 111 |
@torch.no_grad()
|
| 112 |
def video_encode(video_path, resolution, no_resize, vae, vae_batch_size=16, device="cuda", width=None, height=None):
|
|
@@ -667,7 +670,16 @@ def get_duration(input_video, end_frame, end_frame_weight, prompt, n_prompt, see
|
|
| 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 671 |
# 20250506 pftq: Updated assertion for video input
|
| 672 |
assert input_video is not None, 'No input video!'
|
| 673 |
|
|
@@ -741,8 +753,8 @@ with block:
|
|
| 741 |
#example_quick_prompts.click(lambda x: x[0], inputs=[example_quick_prompts], outputs=prompt, show_progress=False, queue=False)
|
| 742 |
|
| 743 |
with gr.Row():
|
| 744 |
-
start_button = gr.Button(value="Start Generation")
|
| 745 |
-
end_button = gr.Button(value="End Generation", interactive=False)
|
| 746 |
|
| 747 |
with gr.Group():
|
| 748 |
with gr.Row():
|
|
@@ -783,13 +795,18 @@ with block:
|
|
| 783 |
|
| 784 |
mp4_crf = gr.Slider(label="MP4 Compression", minimum=0, maximum=100, value=16, step=1, info="Lower means better quality. 0 is uncompressed. Change to 16 if you get black outputs. ")
|
| 785 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 786 |
with gr.Column():
|
| 787 |
preview_image = gr.Image(label="Next Latents", height=200, visible=False)
|
| 788 |
result_video = gr.Video(label="Finished Frames", autoplay=True, show_share_button=False, height=512, loop=True)
|
| 789 |
progress_desc = gr.Markdown('', elem_classes='no-generating-animation')
|
| 790 |
progress_bar = gr.HTML('', elem_classes='no-generating-animation')
|
| 791 |
|
| 792 |
-
gr.
|
|
|
|
| 793 |
examples = [
|
| 794 |
[
|
| 795 |
"./img_examples/Example1.mp4", # input_video
|
|
@@ -830,4 +847,26 @@ with block:
|
|
| 830 |
end_button.click(fn=end_process)
|
| 831 |
|
| 832 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 833 |
block.launch(share=True)
|
|
|
|
| 107 |
outputs_folder = './outputs/'
|
| 108 |
os.makedirs(outputs_folder, exist_ok=True)
|
| 109 |
|
| 110 |
+
input_video_debug_value = None
|
| 111 |
+
prompt_debug_value = None
|
| 112 |
+
|
| 113 |
# 20250506 pftq: Added function to encode input video frames into latents
|
| 114 |
@torch.no_grad()
|
| 115 |
def video_encode(video_path, resolution, no_resize, vae, vae_batch_size=16, device="cuda", width=None, height=None):
|
|
|
|
| 670 |
|
| 671 |
@spaces.GPU(duration=get_duration)
|
| 672 |
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):
|
| 673 |
+
global stream, high_vram, input_video_debug_value, prompt_debug_value
|
| 674 |
+
|
| 675 |
+
if input_video_debug_value is not None:
|
| 676 |
+
input_video = input_video_debug_value
|
| 677 |
+
input_video_debug_value = None
|
| 678 |
+
|
| 679 |
+
if prompt_debug_value is not None:
|
| 680 |
+
prompt = prompt_debug_value
|
| 681 |
+
prompt_debug_value = None
|
| 682 |
+
|
| 683 |
# 20250506 pftq: Updated assertion for video input
|
| 684 |
assert input_video is not None, 'No input video!'
|
| 685 |
|
|
|
|
| 753 |
#example_quick_prompts.click(lambda x: x[0], inputs=[example_quick_prompts], outputs=prompt, show_progress=False, queue=False)
|
| 754 |
|
| 755 |
with gr.Row():
|
| 756 |
+
start_button = gr.Button(value="Start Generation", variant="primary")
|
| 757 |
+
end_button = gr.Button(value="End Generation", variant="stop", interactive=False)
|
| 758 |
|
| 759 |
with gr.Group():
|
| 760 |
with gr.Row():
|
|
|
|
| 795 |
|
| 796 |
mp4_crf = gr.Slider(label="MP4 Compression", minimum=0, maximum=100, value=16, step=1, info="Lower means better quality. 0 is uncompressed. Change to 16 if you get black outputs. ")
|
| 797 |
|
| 798 |
+
with gr.Row():
|
| 799 |
+
input_video_debug = gr.Video(sources='upload', label="Input Video Debug", height=320)
|
| 800 |
+
prompt_debug = gr.Textbox(label="Prompt Debug", value='')
|
| 801 |
+
|
| 802 |
with gr.Column():
|
| 803 |
preview_image = gr.Image(label="Next Latents", height=200, visible=False)
|
| 804 |
result_video = gr.Video(label="Finished Frames", autoplay=True, show_share_button=False, height=512, loop=True)
|
| 805 |
progress_desc = gr.Markdown('', elem_classes='no-generating-animation')
|
| 806 |
progress_bar = gr.HTML('', elem_classes='no-generating-animation')
|
| 807 |
|
| 808 |
+
with gr.Row(visible=False):
|
| 809 |
+
gr.Examples(
|
| 810 |
examples = [
|
| 811 |
[
|
| 812 |
"./img_examples/Example1.mp4", # input_video
|
|
|
|
| 847 |
end_button.click(fn=end_process)
|
| 848 |
|
| 849 |
|
| 850 |
+
def handle_input_video_debug_upload(input):
|
| 851 |
+
global input_video_debug_value
|
| 852 |
+
input_video_debug_value = input
|
| 853 |
+
return []
|
| 854 |
+
|
| 855 |
+
def handle_prompt_debug_change(input):
|
| 856 |
+
global prompt_debug_value
|
| 857 |
+
prompt_debug_value = input
|
| 858 |
+
return []
|
| 859 |
+
|
| 860 |
+
input_video_debug.upload(
|
| 861 |
+
fn=handle_input_video_debug_upload,
|
| 862 |
+
inputs=[input_video_debug],
|
| 863 |
+
outputs=[]
|
| 864 |
+
)
|
| 865 |
+
|
| 866 |
+
prompt_debug.change(
|
| 867 |
+
fn=handle_prompt_debug_change,
|
| 868 |
+
inputs=[prompt_debug],
|
| 869 |
+
outputs=[]
|
| 870 |
+
)
|
| 871 |
+
|
| 872 |
block.launch(share=True)
|