Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -711,77 +711,87 @@ def generate_video(
|
|
| 711 |
log_memory("on error")
|
| 712 |
print(f"Error: {str(e)}\n{traceback.format_exc()}")
|
| 713 |
return None, current_seed
|
| 714 |
-
|
| 715 |
-
|
| 716 |
with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
| 717 |
gr.Markdown("# LTX-2.3 F2LF with Fast Audio-Video Generation and Lora support")
|
|
|
|
| 718 |
|
| 719 |
with gr.Row():
|
| 720 |
-
# ================= LEFT PANEL =================
|
| 721 |
with gr.Column():
|
| 722 |
with gr.Row():
|
| 723 |
first_image = gr.Image(label="First Frame (Optional)", type="pil")
|
| 724 |
last_image = gr.Image(label="Last Frame (Optional)", type="pil")
|
| 725 |
-
|
| 726 |
input_audio = gr.Audio(label="Audio Input (Optional)", type="filepath")
|
| 727 |
-
|
| 728 |
prompt = gr.Textbox(
|
| 729 |
label="Prompt",
|
| 730 |
info="for best results - make it as elaborate as possible",
|
| 731 |
value="Make this image come alive with cinematic motion, smooth animation",
|
| 732 |
lines=3,
|
|
|
|
| 733 |
)
|
| 734 |
-
|
| 735 |
duration = gr.Slider(label="Duration (seconds)", minimum=1.0, maximum=30.0, value=10.0, step=0.1)
|
|
|
|
| 736 |
|
| 737 |
generate_btn = gr.Button("Generate Video", variant="primary", size="lg")
|
| 738 |
|
| 739 |
with gr.Accordion("Advanced Settings", open=True):
|
| 740 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, value=10, step=1)
|
| 741 |
randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
|
| 742 |
-
|
| 743 |
with gr.Row():
|
| 744 |
width = gr.Number(label="Width", value=1536, precision=0)
|
| 745 |
height = gr.Number(label="Height", value=1024, precision=0)
|
| 746 |
-
|
| 747 |
with gr.Row():
|
| 748 |
enhance_prompt = gr.Checkbox(label="Enhance Prompt", value=False)
|
| 749 |
high_res = gr.Checkbox(label="High Resolution", value=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 750 |
|
| 751 |
-
gr.Markdown("### LoRA adapter strengths")
|
| 752 |
-
|
| 753 |
-
paste_strength = gr.Slider("Paste", 0, 2, 0)
|
| 754 |
-
ruri_strength = gr.Slider("Ruri", 0, 2, 0)
|
| 755 |
-
transit_strength = gr.Slider("Transition", 0, 2, 0)
|
| 756 |
-
pose_strength = gr.Slider("Pose", 0, 2, 0)
|
| 757 |
-
general_strength = gr.Slider("General", 0, 2, 0)
|
| 758 |
-
motion_strength = gr.Slider("Motion", 0, 2, 0)
|
| 759 |
-
dreamlay_strength = gr.Slider("Dreamlay", 0, 2, 0)
|
| 760 |
-
mself_strength = gr.Slider("Mself", 0, 2, 0)
|
| 761 |
-
dramatic_strength = gr.Slider("Dramatic", 0, 2, 0)
|
| 762 |
-
fluid_strength = gr.Slider("Fluid", 0, 2, 0)
|
| 763 |
-
liquid_strength = gr.Slider("Liquid", 0, 2, 0)
|
| 764 |
-
demopose_strength = gr.Slider("Demopose", 0, 2, 0)
|
| 765 |
-
|
| 766 |
-
prepare_lora_btn = gr.Button("Prepare / Load LoRA Cache")
|
| 767 |
-
lora_status = gr.Textbox(value="No LoRA state prepared yet.", interactive=False)
|
| 768 |
-
|
| 769 |
-
# ================= RIGHT PANEL =================
|
| 770 |
with gr.Column():
|
| 771 |
-
output_video = gr.Video(label="Generated Video")
|
| 772 |
-
gpu_duration = gr.Slider(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 773 |
|
| 774 |
-
# ================= EXAMPLES =================
|
| 775 |
gr.Examples(
|
| 776 |
examples=[
|
| 777 |
[
|
| 778 |
-
"asc.jpg",
|
| 779 |
-
|
| 780 |
-
|
| 781 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 782 |
1.0,
|
| 783 |
-
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
|
| 784 |
-
]
|
|
|
|
| 785 |
],
|
| 786 |
inputs=[
|
| 787 |
first_image, last_image, input_audio, prompt, duration, gpu_duration,
|
|
@@ -792,46 +802,57 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 792 |
],
|
| 793 |
)
|
| 794 |
|
| 795 |
-
#
|
| 796 |
with gr.Column():
|
| 797 |
gr.Markdown("## 🎬 Example Output")
|
| 798 |
|
| 799 |
-
gr.Textbox(
|
| 800 |
label="Prompt",
|
| 801 |
-
value="KABAPASTE The girl is squeezed from a tube like paste...",
|
| 802 |
interactive=False
|
| 803 |
)
|
| 804 |
|
| 805 |
-
gr.Video(
|
| 806 |
-
value="abc.mp4", #
|
| 807 |
-
autoplay=True
|
|
|
|
| 808 |
)
|
| 809 |
|
| 810 |
-
|
| 811 |
-
|
| 812 |
-
|
| 813 |
-
|
|
|
|
| 814 |
|
| 815 |
-
|
| 816 |
-
|
| 817 |
-
[
|
| 818 |
-
|
| 819 |
-
fluid_strength, liquid_strength, demopose_strength],
|
| 820 |
-
[lora_status],
|
| 821 |
)
|
| 822 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 823 |
generate_btn.click(
|
| 824 |
-
generate_video,
|
| 825 |
-
[
|
| 826 |
-
first_image, last_image, input_audio, prompt, duration, gpu_duration,
|
| 827 |
-
|
| 828 |
-
paste_strength, ruri_strength, transit_strength, pose_strength,
|
| 829 |
-
general_strength, motion_strength, dreamlay_strength, mself_strength,
|
| 830 |
-
dramatic_strength, fluid_strength, liquid_strength, demopose_strength,
|
| 831 |
],
|
| 832 |
-
[output_video, seed],
|
| 833 |
)
|
| 834 |
|
|
|
|
| 835 |
css = """
|
| 836 |
.fillable{max-width: 1200px !important}
|
| 837 |
"""
|
|
|
|
| 711 |
log_memory("on error")
|
| 712 |
print(f"Error: {str(e)}\n{traceback.format_exc()}")
|
| 713 |
return None, current_seed
|
|
|
|
|
|
|
| 714 |
with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
| 715 |
gr.Markdown("# LTX-2.3 F2LF with Fast Audio-Video Generation and Lora support")
|
| 716 |
+
|
| 717 |
|
| 718 |
with gr.Row():
|
|
|
|
| 719 |
with gr.Column():
|
| 720 |
with gr.Row():
|
| 721 |
first_image = gr.Image(label="First Frame (Optional)", type="pil")
|
| 722 |
last_image = gr.Image(label="Last Frame (Optional)", type="pil")
|
|
|
|
| 723 |
input_audio = gr.Audio(label="Audio Input (Optional)", type="filepath")
|
|
|
|
| 724 |
prompt = gr.Textbox(
|
| 725 |
label="Prompt",
|
| 726 |
info="for best results - make it as elaborate as possible",
|
| 727 |
value="Make this image come alive with cinematic motion, smooth animation",
|
| 728 |
lines=3,
|
| 729 |
+
placeholder="Describe the motion and animation you want...",
|
| 730 |
)
|
|
|
|
| 731 |
duration = gr.Slider(label="Duration (seconds)", minimum=1.0, maximum=30.0, value=10.0, step=0.1)
|
| 732 |
+
|
| 733 |
|
| 734 |
generate_btn = gr.Button("Generate Video", variant="primary", size="lg")
|
| 735 |
|
| 736 |
with gr.Accordion("Advanced Settings", open=True):
|
| 737 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, value=10, step=1)
|
| 738 |
randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
|
|
|
|
| 739 |
with gr.Row():
|
| 740 |
width = gr.Number(label="Width", value=1536, precision=0)
|
| 741 |
height = gr.Number(label="Height", value=1024, precision=0)
|
|
|
|
| 742 |
with gr.Row():
|
| 743 |
enhance_prompt = gr.Checkbox(label="Enhance Prompt", value=False)
|
| 744 |
high_res = gr.Checkbox(label="High Resolution", value=True)
|
| 745 |
+
with gr.Column():
|
| 746 |
+
gr.Markdown("### LoRA adapter strengths (set to 0 to disable)")
|
| 747 |
+
paste_strength = gr.Slider(label="Paste anything Lora strength", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 748 |
+
ruri_strength = gr.Slider(label="Ruri lady Lora strength", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 749 |
+
transit_strength = gr.Slider(label="Transition Lora strength", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 750 |
+
pose_strength = gr.Slider(label="Anthro Enhancer strength", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 751 |
+
general_strength = gr.Slider(label="Reasoning Enhancer strength", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 752 |
+
motion_strength = gr.Slider(label="Anthro Posing Helper strength", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 753 |
+
dreamlay_strength = gr.Slider(label="Dreamfly strength", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 754 |
+
mself_strength = gr.Slider(label="Mself strength", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 755 |
+
dramatic_strength = gr.Slider(label="Dramatic strength", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 756 |
+
fluid_strength = gr.Slider(label="Fluid Helper strength", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 757 |
+
liquid_strength = gr.Slider(label="Liquid Helper strength", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 758 |
+
demopose_strength = gr.Slider(label="Demopose Helper strength", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 759 |
+
|
| 760 |
+
prepare_lora_btn = gr.Button("Prepare / Load LoRA Cache", variant="secondary")
|
| 761 |
+
lora_status = gr.Textbox(
|
| 762 |
+
label="LoRA Cache Status",
|
| 763 |
+
value="No LoRA state prepared yet.",
|
| 764 |
+
interactive=False,
|
| 765 |
+
)
|
| 766 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 767 |
with gr.Column():
|
| 768 |
+
output_video = gr.Video(label="Generated Video", autoplay=False)
|
| 769 |
+
gpu_duration = gr.Slider(
|
| 770 |
+
label="ZeroGPU duration (seconds)",
|
| 771 |
+
minimum=40.0,
|
| 772 |
+
maximum=240.0,
|
| 773 |
+
value=85.0,
|
| 774 |
+
step=1.0,
|
| 775 |
+
)
|
| 776 |
|
|
|
|
| 777 |
gr.Examples(
|
| 778 |
examples=[
|
| 779 |
[
|
| 780 |
+
"asc.jpg",
|
| 781 |
+
None,
|
| 782 |
+
None,
|
| 783 |
+
"A low-angle wide shot establishes a winding, wet asphalt road flanked by a dense, dark forest...",
|
| 784 |
+
3.0,
|
| 785 |
+
80.0,
|
| 786 |
+
False,
|
| 787 |
+
42,
|
| 788 |
+
True,
|
| 789 |
+
1024,
|
| 790 |
+
1024,
|
| 791 |
1.0,
|
| 792 |
+
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
| 793 |
+
],
|
| 794 |
+
[None, "asc.jpg", "KABAPASTE The girl is squeezed from a tube like paste...", "paste lora"]
|
| 795 |
],
|
| 796 |
inputs=[
|
| 797 |
first_image, last_image, input_audio, prompt, duration, gpu_duration,
|
|
|
|
| 802 |
],
|
| 803 |
)
|
| 804 |
|
| 805 |
+
# ✅ FIXED EXAMPLE OUTPUT SECTION (ONLY CHANGE)
|
| 806 |
with gr.Column():
|
| 807 |
gr.Markdown("## 🎬 Example Output")
|
| 808 |
|
| 809 |
+
prompt_preview = gr.Textbox(
|
| 810 |
label="Prompt",
|
| 811 |
+
value="KABAPASTE The girl is squeezed from a tube like paste. The video is silent with the sound of rain and squeezing sounds. After the girl forms, her umbrella opens up.",
|
| 812 |
interactive=False
|
| 813 |
)
|
| 814 |
|
| 815 |
+
video_preview = gr.Video(
|
| 816 |
+
value="abc.mp4", # make sure correct path
|
| 817 |
+
autoplay=True,
|
| 818 |
+
interactive=False
|
| 819 |
)
|
| 820 |
|
| 821 |
+
first_image.change(
|
| 822 |
+
fn=on_image_upload,
|
| 823 |
+
inputs=[first_image, last_image, high_res],
|
| 824 |
+
outputs=[width, height],
|
| 825 |
+
)
|
| 826 |
|
| 827 |
+
last_image.change(
|
| 828 |
+
fn=on_image_upload,
|
| 829 |
+
inputs=[first_image, last_image, high_res],
|
| 830 |
+
outputs=[width, height],
|
|
|
|
|
|
|
| 831 |
)
|
| 832 |
|
| 833 |
+
high_res.change(
|
| 834 |
+
fn=on_highres_toggle,
|
| 835 |
+
inputs=[first_image, last_image, high_res],
|
| 836 |
+
outputs=[width, height],
|
| 837 |
+
)
|
| 838 |
+
|
| 839 |
+
prepare_lora_btn.click(
|
| 840 |
+
fn=prepare_lora_cache,
|
| 841 |
+
inputs=[paste_strength, ruri_strength, transit_strength, pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength],
|
| 842 |
+
outputs=[lora_status],
|
| 843 |
+
)
|
| 844 |
+
|
| 845 |
generate_btn.click(
|
| 846 |
+
fn=generate_video,
|
| 847 |
+
inputs=[
|
| 848 |
+
first_image, last_image, input_audio, prompt, duration, gpu_duration, enhance_prompt,
|
| 849 |
+
seed, randomize_seed, height, width,
|
| 850 |
+
paste_strength, ruri_strength, transit_strength, pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength,
|
|
|
|
|
|
|
| 851 |
],
|
| 852 |
+
outputs=[output_video, seed],
|
| 853 |
)
|
| 854 |
|
| 855 |
+
|
| 856 |
css = """
|
| 857 |
.fillable{max-width: 1200px !important}
|
| 858 |
"""
|