Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -715,184 +715,122 @@ def generate_video(
|
|
| 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 |
|
| 720 |
with gr.Row():
|
|
|
|
| 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 |
input_audio = gr.Audio(label="Audio Input (Optional)", type="filepath")
|
|
|
|
| 726 |
prompt = gr.Textbox(
|
| 727 |
label="Prompt",
|
| 728 |
info="for best results - make it as elaborate as possible",
|
| 729 |
value="Make this image come alive with cinematic motion, smooth animation",
|
| 730 |
lines=3,
|
| 731 |
-
placeholder="Describe the motion and animation you want...",
|
| 732 |
)
|
|
|
|
| 733 |
duration = gr.Slider(label="Duration (seconds)", minimum=1.0, maximum=30.0, value=10.0, step=0.1)
|
| 734 |
-
|
| 735 |
|
| 736 |
generate_btn = gr.Button("Generate Video", variant="primary", size="lg")
|
| 737 |
|
| 738 |
with gr.Accordion("Advanced Settings", open=True):
|
| 739 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, value=10, step=1)
|
| 740 |
randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
|
|
|
|
| 741 |
with gr.Row():
|
| 742 |
width = gr.Number(label="Width", value=1536, precision=0)
|
| 743 |
height = gr.Number(label="Height", value=1024, precision=0)
|
|
|
|
| 744 |
with gr.Row():
|
| 745 |
enhance_prompt = gr.Checkbox(label="Enhance Prompt", value=False)
|
| 746 |
high_res = gr.Checkbox(label="High Resolution", value=True)
|
| 747 |
-
with gr.Column():
|
| 748 |
-
gr.Markdown("### LoRA adapter strengths (set to 0 to disable)")
|
| 749 |
-
paste_strength = gr.Slider(
|
| 750 |
-
label="Paste anything Lora strength",
|
| 751 |
-
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 752 |
-
)
|
| 753 |
-
ruri_strength = gr.Slider(
|
| 754 |
-
label="Ruri lady Lora strength",
|
| 755 |
-
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 756 |
-
)
|
| 757 |
-
transit_strength = gr.Slider(
|
| 758 |
-
label="Transition Lora strength",
|
| 759 |
-
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 760 |
-
)
|
| 761 |
-
pose_strength = gr.Slider(
|
| 762 |
-
label="Anthro Enhancer strength",
|
| 763 |
-
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 764 |
-
)
|
| 765 |
-
general_strength = gr.Slider(
|
| 766 |
-
label="Reasoning Enhancer strength",
|
| 767 |
-
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 768 |
-
)
|
| 769 |
-
motion_strength = gr.Slider(
|
| 770 |
-
label="Anthro Posing Helper strength",
|
| 771 |
-
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 772 |
-
)
|
| 773 |
-
dreamlay_strength = gr.Slider(
|
| 774 |
-
label="Dreamfly strength",
|
| 775 |
-
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 776 |
-
)
|
| 777 |
-
mself_strength = gr.Slider(
|
| 778 |
-
label="Mself strength",
|
| 779 |
-
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 780 |
-
)
|
| 781 |
-
dramatic_strength = gr.Slider(
|
| 782 |
-
label="Dramatic strength",
|
| 783 |
-
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 784 |
-
)
|
| 785 |
-
fluid_strength = gr.Slider(
|
| 786 |
-
label="Fluid Helper strength",
|
| 787 |
-
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 788 |
-
)
|
| 789 |
-
liquid_strength = gr.Slider(
|
| 790 |
-
label="Liquid Helper strength",
|
| 791 |
-
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 792 |
-
)
|
| 793 |
-
demopose_strength = gr.Slider(
|
| 794 |
-
label="Demopose Helper strength",
|
| 795 |
-
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 796 |
-
)
|
| 797 |
-
prepare_lora_btn = gr.Button("Prepare / Load LoRA Cache", variant="secondary")
|
| 798 |
-
lora_status = gr.Textbox(
|
| 799 |
-
label="LoRA Cache Status",
|
| 800 |
-
value="No LoRA state prepared yet.",
|
| 801 |
-
interactive=False,
|
| 802 |
-
)
|
| 803 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 804 |
with gr.Column():
|
| 805 |
-
output_video = gr.Video(label="Generated Video"
|
| 806 |
-
gpu_duration = gr.Slider(
|
| 807 |
-
label="ZeroGPU duration (seconds)",
|
| 808 |
-
minimum=40.0,
|
| 809 |
-
maximum=240.0,
|
| 810 |
-
value=85.0,
|
| 811 |
-
step=1.0,
|
| 812 |
-
)
|
| 813 |
|
|
|
|
| 814 |
gr.Examples(
|
| 815 |
examples=[
|
| 816 |
[
|
| 817 |
-
|
| 818 |
-
"
|
| 819 |
-
|
| 820 |
-
|
| 821 |
-
"A low-angle wide shot establishes a winding, wet asphalt road flanked by a dense, dark forest where heavy fog clings to the mossy tree trunks. The glistening surface of the road reflects the dim, moody light, highlighting the vibrant double yellow lines that curve into the misty distance. The camera glides forward smoothly at a low height, tracking the damp texture of the pavement as droplets of moisture fall from the overhanging emerald canopy. Suddenly, the camera tilts upward and accelerates, piercing through the thick, grey veil of the forest ceiling and ascending rapidly into a dense layer of rolling white clouds. As the camera breaks through the cloud deck, it reveals a breathtaking vista of a sharp, snow-dusted mountain peak piercing a brilliant, clear blue sky. The jagged rock textures and icy ridges of the summit are illuminated by crisp, high-altitude sunlight while soft clouds drift slowly around the mountain's base. The ambient sound begins with the rhythmic hum of tires on wet pavement and the soft dripping of water, transitioning into a deep, ethereal wind howl as the camera reaches the silent majesty of the peak, zhuanchang",
|
| 822 |
-
3.0,
|
| 823 |
-
80.0,
|
| 824 |
-
False,
|
| 825 |
-
42,
|
| 826 |
-
True,
|
| 827 |
-
1024,
|
| 828 |
-
1024,
|
| 829 |
1.0,
|
| 830 |
-
0.0,
|
| 831 |
-
|
| 832 |
-
0.0, # motion_strength (example)
|
| 833 |
-
0.0,
|
| 834 |
-
0.0,
|
| 835 |
-
0.0,
|
| 836 |
-
0.0,
|
| 837 |
-
0.0,
|
| 838 |
-
0.0,
|
| 839 |
-
],[None,"asc.jpg","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.","paste lora"]
|
| 840 |
],
|
| 841 |
inputs=[
|
| 842 |
first_image, last_image, input_audio, prompt, duration, gpu_duration,
|
| 843 |
enhance_prompt, seed, randomize_seed, height, width,
|
| 844 |
-
paste_strength,pose_strength, general_strength, motion_strength,
|
|
|
|
|
|
|
| 845 |
],
|
| 846 |
-
|
| 847 |
)
|
| 848 |
|
| 849 |
-
|
| 850 |
-
|
| 851 |
-
|
| 852 |
-
outputs=[width, height],
|
| 853 |
-
)
|
| 854 |
|
| 855 |
-
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
|
| 859 |
-
|
| 860 |
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 866 |
|
| 867 |
prepare_lora_btn.click(
|
| 868 |
-
|
| 869 |
-
|
| 870 |
-
|
|
|
|
|
|
|
| 871 |
)
|
| 872 |
-
|
| 873 |
generate_btn.click(
|
| 874 |
-
|
| 875 |
-
|
| 876 |
-
first_image, last_image, input_audio, prompt, duration, gpu_duration,
|
| 877 |
-
seed, randomize_seed, height, width,
|
| 878 |
-
paste_strength,ruri_strength,transit_strength,pose_strength,
|
|
|
|
|
|
|
| 879 |
],
|
| 880 |
-
|
| 881 |
)
|
| 882 |
-
with gr.Column():
|
| 883 |
-
gr.Markdown("## 🎬 Example Output")
|
| 884 |
-
|
| 885 |
-
prompt_preview = gr.Textbox(
|
| 886 |
-
label="Prompt",
|
| 887 |
-
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.",
|
| 888 |
-
interactive=False
|
| 889 |
-
)
|
| 890 |
-
|
| 891 |
-
video_preview = gr.Video(
|
| 892 |
-
value="abc.mp4",
|
| 893 |
-
autoplay=True
|
| 894 |
-
)
|
| 895 |
-
|
| 896 |
|
| 897 |
css = """
|
| 898 |
.fillable{max-width: 1200px !important}
|
|
|
|
| 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("ZeroGPU duration", 40, 240, 85)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 773 |
|
| 774 |
+
# ================= EXAMPLES =================
|
| 775 |
gr.Examples(
|
| 776 |
examples=[
|
| 777 |
[
|
| 778 |
+
"asc.jpg", None, None,
|
| 779 |
+
"A low-angle cinematic road scene...",
|
| 780 |
+
3.0, 80.0, False, 42, True,
|
| 781 |
+
1024, 1024,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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,
|
| 788 |
enhance_prompt, seed, randomize_seed, height, width,
|
| 789 |
+
paste_strength, pose_strength, general_strength, motion_strength,
|
| 790 |
+
dreamlay_strength, mself_strength, dramatic_strength,
|
| 791 |
+
fluid_strength, liquid_strength, demopose_strength,
|
| 792 |
],
|
|
|
|
| 793 |
)
|
| 794 |
|
| 795 |
+
# ================= 🔥 SEPARATE EXAMPLE OUTPUT =================
|
| 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", # ensure file exists
|
| 807 |
+
autoplay=True
|
| 808 |
+
)
|
| 809 |
+
|
| 810 |
+
# ================= EVENTS =================
|
| 811 |
+
first_image.change(on_image_upload, [first_image, last_image, high_res], [width, height])
|
| 812 |
+
last_image.change(on_image_upload, [first_image, last_image, high_res], [width, height])
|
| 813 |
+
high_res.change(on_highres_toggle, [first_image, last_image, high_res], [width, height])
|
| 814 |
|
| 815 |
prepare_lora_btn.click(
|
| 816 |
+
prepare_lora_cache,
|
| 817 |
+
[paste_strength, ruri_strength, transit_strength, pose_strength, general_strength,
|
| 818 |
+
motion_strength, dreamlay_strength, mself_strength, dramatic_strength,
|
| 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 |
+
enhance_prompt, seed, randomize_seed, height, width,
|
| 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}
|