AashishNKumar commited on
Commit
f95820c
·
verified ·
1 Parent(s): 5e3cd41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +278 -174
app.py CHANGED
@@ -533,6 +533,265 @@ def create_advanced_options():
533
 
534
 
535
  # Define the Gradio interface with tabs
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
536
  with gr.Blocks(theme=gr.themes.Soft()) as iface:
537
  with gr.Row(elem_id="title-row"):
538
  gr.Markdown(
@@ -542,133 +801,29 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
542
  </div>
543
  """
544
  )
545
- # with gr.Row(elem_id="title-row"):
546
- # gr.HTML( # add technical report link
547
- # """
548
- # <div style="display:flex;column-gap:4px;">
549
- # <a href="https://github.com/Lightricks/LTX-Video">
550
- # <img src='https://img.shields.io/badge/GitHub-Repo-blue'>
551
- # </a>
552
- # <a href="https://github.com/Lightricks/ComfyUI-LTXVideo">
553
- # <img src='https://img.shields.io/badge/GitHub-ComfyUI-blue'>
554
- # </a>
555
- # <a href="http://www.lightricks.com/ltxv">
556
- # <img src="https://img.shields.io/badge/Project-Page-green" alt="Follow me on HF">
557
- # </a>
558
- # <a href="https://huggingface.co/spaces/Lightricks/LTX-Video-Playground?duplicate=true">
559
- # <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-sm.svg" alt="Duplicate this Space">
560
- # </a>
561
- # <a href="https://huggingface.co/Lightricks">
562
- # <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/follow-me-on-HF-sm-dark.svg" alt="Follow me on HF">
563
- # </a>
564
- # </div>
565
- # """
566
- # )
567
  with gr.Accordion(" 📖 Tips for Best Results", open=False, elem_id="instructions-accordion"):
568
  gr.Markdown(
569
  """
570
- 📝 Prompt Engineering
571
-
572
- When writing prompts, focus on detailed, chronological descriptions of actions and scenes. Include specific movements, appearances, camera angles, and environmental details - all in a single flowing paragraph. Start directly with the action, and keep descriptions literal and precise. Think like a cinematographer describing a shot list. Keep within 200 words.
573
- For best results, build your prompts using this structure:
574
-
575
- - Start with main action in a single sentence
576
  - Add specific details about movements and gestures
577
  - Describe character/object appearances precisely
578
  - Include background and environment details
579
  - Specify camera angles and movements
580
- - Describe lighting and colors
581
- - Note any changes or sudden events
582
-
583
  See examples for more inspiration.
584
-
585
- 🎮 Parameter Guide
586
-
587
- - Resolution Preset: Higher resolutions for detailed scenes, lower for faster generation and simpler scenes
588
- - Seed: Save seed values to recreate specific styles or compositions you like
589
- - Guidance Scale: 3-3.5 are the recommended values
590
- - Inference Steps: More steps (40+) for quality, fewer steps (20-30) for speed
591
  """
592
  )
593
 
594
  with gr.Tabs():
595
- # # Text to Video Tab
596
- # with gr.TabItem("Text to Video"):
597
- # with gr.Row():
598
- # with gr.Column():
599
- # txt2vid_prompt = gr.Textbox(
600
- # label="Step 1: Enter Your Prompt",
601
- # placeholder="Describe the video you want to generate (minimum 50 characters)...",
602
- # value="A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage.",
603
- # lines=5,
604
- # )
605
- # txt2vid_analytics_toggle = Toggle(
606
- # label="I agree to share my usage data anonymously to help improve the model features.",
607
- # value=True,
608
- # interactive=True,
609
- # )
610
-
611
- # txt2vid_enhance_toggle = Toggle(
612
- # label="Enhance Prompt",
613
- # value=False,
614
- # interactive=True,
615
- # )
616
-
617
- # txt2vid_negative_prompt = gr.Textbox(
618
- # label="Step 2: Enter Negative Prompt",
619
- # placeholder="Describe what you don't want in the video...",
620
- # value="low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
621
- # lines=2,
622
- # )
623
-
624
- # txt2vid_preset = gr.Dropdown(
625
- # choices=[p["label"] for p in preset_options],
626
- # value="768x512, 97 frames",
627
- # label="Step 3.1: Choose Resolution Preset",
628
- # )
629
-
630
- # txt2vid_frame_rate = gr.Slider(
631
- # label="Step 3.2: Frame Rate",
632
- # minimum=21,
633
- # maximum=30,
634
- # step=1,
635
- # value=25,
636
- # )
637
-
638
- # txt2vid_advanced = create_advanced_options()
639
- # txt2vid_generate = gr.Button(
640
- # "Step 5: Generate Video",
641
- # variant="primary",
642
- # size="lg",
643
- # )
644
-
645
- # with gr.Column():
646
- # txt2vid_output = gr.Video(label="Generated Output")
647
-
648
- # with gr.Row():
649
- # gr.Examples(
650
- # examples=[
651
- # [
652
- # "A young woman in a traditional Mongolian dress is peeking through a sheer white curtain, her face showing a mix of curiosity and apprehension. The woman has long black hair styled in two braids, adorned with white beads, and her eyes are wide with a hint of surprise. Her dress is a vibrant blue with intricate gold embroidery, and she wears a matching headband with a similar design. The background is a simple white curtain, which creates a sense of mystery and intrigue.ith long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair’s face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage",
653
- # "low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
654
- # "assets/t2v_2.mp4",
655
- # ],
656
- # [
657
- # "A young man with blond hair wearing a yellow jacket stands in a forest and looks around. He has light skin and his hair is styled with a middle part. He looks to the left and then to the right, his gaze lingering in each direction. The camera angle is low, looking up at the man, and remains stationary throughout the video. The background is slightly out of focus, with green trees and the sun shining brightly behind the man. The lighting is natural and warm, with the sun creating a lens flare that moves across the man’s face. The scene is captured in real-life footage.",
658
- # "low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
659
- # "assets/t2v_1.mp4",
660
- # ],
661
- # [
662
- # "A cyclist races along a winding mountain road. Clad in aerodynamic gear, he pedals intensely, sweat glistening on his brow. The camera alternates between close-ups of his determined expression and wide shots of the breathtaking landscape. Pine trees blur past, and the sky is a crisp blue. The scene is invigorating and competitive.",
663
- # "low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
664
- # "assets/t2v_0.mp4",
665
- # ],
666
- # ],
667
- # inputs=[txt2vid_prompt, txt2vid_negative_prompt, txt2vid_output],
668
- # label="Example Text-to-Video Generations",
669
- # )
670
-
671
- # Image to Video Tab
672
  with gr.TabItem("Image to Video"):
673
  with gr.Row():
674
  with gr.Column():
@@ -683,12 +838,12 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
683
  value="A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage.",
684
  lines=5,
685
  )
686
- img2vid_analytics_toggle = Toggle(
687
  label="I agree to share my usage data anonymously to help improve the model features.",
688
  value=True,
689
  interactive=True,
690
  )
691
- img2vid_enhance_toggle = Toggle(
692
  label="Enhance Prompt",
693
  value=False,
694
  interactive=True,
@@ -699,13 +854,11 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
699
  value="low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
700
  lines=2,
701
  )
702
-
703
  img2vid_preset = gr.Dropdown(
704
- choices=[p["label"] for p in preset_options],
705
  value="768x512, 97 frames",
706
  label="Step 3.1: Choose Resolution Preset",
707
  )
708
-
709
  img2vid_frame_rate = gr.Slider(
710
  label="Step 3.2: Frame Rate",
711
  minimum=21,
@@ -713,64 +866,14 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
713
  step=1,
714
  value=25,
715
  )
716
-
717
- img2vid_advanced = create_advanced_options()
718
  img2vid_generate = gr.Button("Step 6: Generate Video", variant="primary", size="lg")
719
 
720
  with gr.Column():
721
  img2vid_output = gr.Video(label="Generated Output")
722
 
723
- # with gr.Row():
724
- # gr.Examples(
725
- # examples=[
726
- # [
727
- # "assets/i2v_i2.png",
728
- # "A woman stirs a pot of boiling water on a white electric burner. Her hands, with purple nail polish, hold a wooden spoon and move it in a circular motion within a white pot filled with bubbling water. The pot sits on a white electric burner with black buttons and a digital display. The burner is positioned on a white countertop with a red and white checkered cloth partially visible in the bottom right corner. The camera angle is a direct overhead shot, remaining stationary throughout the scene. The lighting is bright and even, illuminating the scene with a neutral white light. The scene is real-life footage.",
729
- # "low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
730
- # "assets/i2v_2.mp4",
731
- # ],
732
- # [
733
- # "assets/i2v_i0.png",
734
- # "A woman in a long, flowing dress stands in a field, her back to the camera, gazing towards the horizon; her hair is long and light, cascading down her back; she stands beneath the sprawling branches of a large oak tree; to her left, a classic American car is parked on the dry grass; in the distance, a wrecked car lies on its side; the sky above is a dramatic canvas of bright white clouds against a darker sky; the entire image is in black and white, emphasizing the contrast of light and shadow. The woman is walking slowly towards the car.",
735
- # "low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
736
- # "assets/i2v_0.mp4",
737
- # ],
738
- # [
739
- # "assets/i2v_i1.png",
740
- # "A pair of hands shapes a piece of clay on a pottery wheel, gradually forming a cone shape. The hands, belonging to a person out of frame, are covered in clay and gently press a ball of clay onto the center of a spinning pottery wheel. The hands move in a circular motion, gradually forming a cone shape at the top of the clay. The camera is positioned directly above the pottery wheel, providing a bird’s-eye view of the clay being shaped. The lighting is bright and even, illuminating the clay and the hands working on it. The scene is captured in real-life footage.",
741
- # "low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
742
- # "assets/i2v_1.mp4",
743
- # ],
744
- # ],
745
- # inputs=[
746
- # img2vid_image,
747
- # img2vid_prompt,
748
- # img2vid_negative_prompt,
749
- # img2vid_output,
750
- # ],
751
- # label="Example Image-to-Video Generations",
752
- # )
753
-
754
- # [Previous event handlers remain the same]
755
- txt2vid_preset.change(fn=preset_changed, inputs=[txt2vid_preset], outputs=txt2vid_advanced[3:])
756
-
757
- txt2vid_generate.click(
758
- fn=generate_video_from_text,
759
- inputs=[
760
- txt2vid_prompt,
761
- txt2vid_enhance_toggle,
762
- txt2vid_analytics_toggle,
763
- txt2vid_negative_prompt,
764
- txt2vid_frame_rate,
765
- *txt2vid_advanced,
766
- ],
767
- outputs=txt2vid_output,
768
- concurrency_limit=1,
769
- concurrency_id="generate_video",
770
- queue=True,
771
- )
772
-
773
- img2vid_preset.change(fn=preset_changed, inputs=[img2vid_preset], outputs=img2vid_advanced[3:])
774
 
775
  img2vid_generate.click(
776
  fn=generate_video_from_image,
@@ -781,7 +884,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
781
  img2vid_analytics_toggle,
782
  img2vid_negative_prompt,
783
  img2vid_frame_rate,
784
- *img2vid_advanced,
785
  ],
786
  outputs=img2vid_output,
787
  concurrency_limit=1,
@@ -791,3 +894,4 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
791
 
792
  if __name__ == "__main__":
793
  iface.queue(max_size=64, default_concurrency_limit=1, api_open=True).launch(share=True, show_api=True)
 
 
533
 
534
 
535
  # Define the Gradio interface with tabs
536
+ # with gr.Blocks(theme=gr.themes.Soft()) as iface:
537
+ # with gr.Row(elem_id="title-row"):
538
+ # gr.Markdown(
539
+ # """
540
+ # <div style="text-align: center; margin-bottom: 1em">
541
+ # <h1 style="font-size: 2.5em; font-weight: 600; margin: 0.5em 0;">Image to Video (GIF)</h1>
542
+ # </div>
543
+ # """
544
+ # )
545
+ # # with gr.Row(elem_id="title-row"):
546
+ # # gr.HTML( # add technical report link
547
+ # # """
548
+ # # <div style="display:flex;column-gap:4px;">
549
+ # # <a href="https://github.com/Lightricks/LTX-Video">
550
+ # # <img src='https://img.shields.io/badge/GitHub-Repo-blue'>
551
+ # # </a>
552
+ # # <a href="https://github.com/Lightricks/ComfyUI-LTXVideo">
553
+ # # <img src='https://img.shields.io/badge/GitHub-ComfyUI-blue'>
554
+ # # </a>
555
+ # # <a href="http://www.lightricks.com/ltxv">
556
+ # # <img src="https://img.shields.io/badge/Project-Page-green" alt="Follow me on HF">
557
+ # # </a>
558
+ # # <a href="https://huggingface.co/spaces/Lightricks/LTX-Video-Playground?duplicate=true">
559
+ # # <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-sm.svg" alt="Duplicate this Space">
560
+ # # </a>
561
+ # # <a href="https://huggingface.co/Lightricks">
562
+ # # <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/follow-me-on-HF-sm-dark.svg" alt="Follow me on HF">
563
+ # # </a>
564
+ # # </div>
565
+ # # """
566
+ # # )
567
+ # with gr.Accordion(" 📖 Tips for Best Results", open=False, elem_id="instructions-accordion"):
568
+ # gr.Markdown(
569
+ # """
570
+ # 📝 Prompt Engineering
571
+
572
+ # When writing prompts, focus on detailed, chronological descriptions of actions and scenes. Include specific movements, appearances, camera angles, and environmental details - all in a single flowing paragraph. Start directly with the action, and keep descriptions literal and precise. Think like a cinematographer describing a shot list. Keep within 200 words.
573
+ # For best results, build your prompts using this structure:
574
+
575
+ # - Start with main action in a single sentence
576
+ # - Add specific details about movements and gestures
577
+ # - Describe character/object appearances precisely
578
+ # - Include background and environment details
579
+ # - Specify camera angles and movements
580
+ # - Describe lighting and colors
581
+ # - Note any changes or sudden events
582
+
583
+ # See examples for more inspiration.
584
+
585
+ # 🎮 Parameter Guide
586
+
587
+ # - Resolution Preset: Higher resolutions for detailed scenes, lower for faster generation and simpler scenes
588
+ # - Seed: Save seed values to recreate specific styles or compositions you like
589
+ # - Guidance Scale: 3-3.5 are the recommended values
590
+ # - Inference Steps: More steps (40+) for quality, fewer steps (20-30) for speed
591
+ # """
592
+ # )
593
+
594
+ # with gr.Tabs():
595
+ # # # Text to Video Tab
596
+ # # with gr.TabItem("Text to Video"):
597
+ # # with gr.Row():
598
+ # # with gr.Column():
599
+ # # txt2vid_prompt = gr.Textbox(
600
+ # # label="Step 1: Enter Your Prompt",
601
+ # # placeholder="Describe the video you want to generate (minimum 50 characters)...",
602
+ # # value="A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage.",
603
+ # # lines=5,
604
+ # # )
605
+ # # txt2vid_analytics_toggle = Toggle(
606
+ # # label="I agree to share my usage data anonymously to help improve the model features.",
607
+ # # value=True,
608
+ # # interactive=True,
609
+ # # )
610
+
611
+ # # txt2vid_enhance_toggle = Toggle(
612
+ # # label="Enhance Prompt",
613
+ # # value=False,
614
+ # # interactive=True,
615
+ # # )
616
+
617
+ # # txt2vid_negative_prompt = gr.Textbox(
618
+ # # label="Step 2: Enter Negative Prompt",
619
+ # # placeholder="Describe what you don't want in the video...",
620
+ # # value="low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
621
+ # # lines=2,
622
+ # # )
623
+
624
+ # # txt2vid_preset = gr.Dropdown(
625
+ # # choices=[p["label"] for p in preset_options],
626
+ # # value="768x512, 97 frames",
627
+ # # label="Step 3.1: Choose Resolution Preset",
628
+ # # )
629
+
630
+ # # txt2vid_frame_rate = gr.Slider(
631
+ # # label="Step 3.2: Frame Rate",
632
+ # # minimum=21,
633
+ # # maximum=30,
634
+ # # step=1,
635
+ # # value=25,
636
+ # # )
637
+
638
+ # # txt2vid_advanced = create_advanced_options()
639
+ # # txt2vid_generate = gr.Button(
640
+ # # "Step 5: Generate Video",
641
+ # # variant="primary",
642
+ # # size="lg",
643
+ # # )
644
+
645
+ # # with gr.Column():
646
+ # # txt2vid_output = gr.Video(label="Generated Output")
647
+
648
+ # # with gr.Row():
649
+ # # gr.Examples(
650
+ # # examples=[
651
+ # # [
652
+ # # "A young woman in a traditional Mongolian dress is peeking through a sheer white curtain, her face showing a mix of curiosity and apprehension. The woman has long black hair styled in two braids, adorned with white beads, and her eyes are wide with a hint of surprise. Her dress is a vibrant blue with intricate gold embroidery, and she wears a matching headband with a similar design. The background is a simple white curtain, which creates a sense of mystery and intrigue.ith long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair’s face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage",
653
+ # # "low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
654
+ # # "assets/t2v_2.mp4",
655
+ # # ],
656
+ # # [
657
+ # # "A young man with blond hair wearing a yellow jacket stands in a forest and looks around. He has light skin and his hair is styled with a middle part. He looks to the left and then to the right, his gaze lingering in each direction. The camera angle is low, looking up at the man, and remains stationary throughout the video. The background is slightly out of focus, with green trees and the sun shining brightly behind the man. The lighting is natural and warm, with the sun creating a lens flare that moves across the man’s face. The scene is captured in real-life footage.",
658
+ # # "low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
659
+ # # "assets/t2v_1.mp4",
660
+ # # ],
661
+ # # [
662
+ # # "A cyclist races along a winding mountain road. Clad in aerodynamic gear, he pedals intensely, sweat glistening on his brow. The camera alternates between close-ups of his determined expression and wide shots of the breathtaking landscape. Pine trees blur past, and the sky is a crisp blue. The scene is invigorating and competitive.",
663
+ # # "low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
664
+ # # "assets/t2v_0.mp4",
665
+ # # ],
666
+ # # ],
667
+ # # inputs=[txt2vid_prompt, txt2vid_negative_prompt, txt2vid_output],
668
+ # # label="Example Text-to-Video Generations",
669
+ # # )
670
+
671
+ # # Image to Video Tab
672
+ # with gr.TabItem("Image to Video"):
673
+ # with gr.Row():
674
+ # with gr.Column():
675
+ # img2vid_image = gr.Image(
676
+ # type="filepath",
677
+ # label="Step 1: Upload Input Image",
678
+ # elem_id="image_upload",
679
+ # )
680
+ # img2vid_prompt = gr.Textbox(
681
+ # label="Step 2: Enter Your Prompt",
682
+ # placeholder="Describe how you want to animate the image (minimum 50 characters)...",
683
+ # value="A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage.",
684
+ # lines=5,
685
+ # )
686
+ # img2vid_analytics_toggle = Toggle(
687
+ # label="I agree to share my usage data anonymously to help improve the model features.",
688
+ # value=True,
689
+ # interactive=True,
690
+ # )
691
+ # img2vid_enhance_toggle = Toggle(
692
+ # label="Enhance Prompt",
693
+ # value=False,
694
+ # interactive=True,
695
+ # )
696
+ # img2vid_negative_prompt = gr.Textbox(
697
+ # label="Step 3: Enter Negative Prompt",
698
+ # placeholder="Describe what you don't want in the video...",
699
+ # value="low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
700
+ # lines=2,
701
+ # )
702
+
703
+ # img2vid_preset = gr.Dropdown(
704
+ # choices=[p["label"] for p in preset_options],
705
+ # value="768x512, 97 frames",
706
+ # label="Step 3.1: Choose Resolution Preset",
707
+ # )
708
+
709
+ # img2vid_frame_rate = gr.Slider(
710
+ # label="Step 3.2: Frame Rate",
711
+ # minimum=21,
712
+ # maximum=30,
713
+ # step=1,
714
+ # value=25,
715
+ # )
716
+
717
+ # img2vid_advanced = create_advanced_options()
718
+ # img2vid_generate = gr.Button("Step 6: Generate Video", variant="primary", size="lg")
719
+
720
+ # with gr.Column():
721
+ # img2vid_output = gr.Video(label="Generated Output")
722
+
723
+ # # with gr.Row():
724
+ # # gr.Examples(
725
+ # # examples=[
726
+ # # [
727
+ # # "assets/i2v_i2.png",
728
+ # # "A woman stirs a pot of boiling water on a white electric burner. Her hands, with purple nail polish, hold a wooden spoon and move it in a circular motion within a white pot filled with bubbling water. The pot sits on a white electric burner with black buttons and a digital display. The burner is positioned on a white countertop with a red and white checkered cloth partially visible in the bottom right corner. The camera angle is a direct overhead shot, remaining stationary throughout the scene. The lighting is bright and even, illuminating the scene with a neutral white light. The scene is real-life footage.",
729
+ # # "low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
730
+ # # "assets/i2v_2.mp4",
731
+ # # ],
732
+ # # [
733
+ # # "assets/i2v_i0.png",
734
+ # # "A woman in a long, flowing dress stands in a field, her back to the camera, gazing towards the horizon; her hair is long and light, cascading down her back; she stands beneath the sprawling branches of a large oak tree; to her left, a classic American car is parked on the dry grass; in the distance, a wrecked car lies on its side; the sky above is a dramatic canvas of bright white clouds against a darker sky; the entire image is in black and white, emphasizing the contrast of light and shadow. The woman is walking slowly towards the car.",
735
+ # # "low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
736
+ # # "assets/i2v_0.mp4",
737
+ # # ],
738
+ # # [
739
+ # # "assets/i2v_i1.png",
740
+ # # "A pair of hands shapes a piece of clay on a pottery wheel, gradually forming a cone shape. The hands, belonging to a person out of frame, are covered in clay and gently press a ball of clay onto the center of a spinning pottery wheel. The hands move in a circular motion, gradually forming a cone shape at the top of the clay. The camera is positioned directly above the pottery wheel, providing a bird’s-eye view of the clay being shaped. The lighting is bright and even, illuminating the clay and the hands working on it. The scene is captured in real-life footage.",
741
+ # # "low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
742
+ # # "assets/i2v_1.mp4",
743
+ # # ],
744
+ # # ],
745
+ # # inputs=[
746
+ # # img2vid_image,
747
+ # # img2vid_prompt,
748
+ # # img2vid_negative_prompt,
749
+ # # img2vid_output,
750
+ # # ],
751
+ # # label="Example Image-to-Video Generations",
752
+ # # )
753
+
754
+ # # [Previous event handlers remain the same]
755
+ # txt2vid_preset.change(fn=preset_changed, inputs=[txt2vid_preset], outputs=txt2vid_advanced[3:])
756
+
757
+ # txt2vid_generate.click(
758
+ # fn=generate_video_from_text,
759
+ # inputs=[
760
+ # txt2vid_prompt,
761
+ # txt2vid_enhance_toggle,
762
+ # txt2vid_analytics_toggle,
763
+ # txt2vid_negative_prompt,
764
+ # txt2vid_frame_rate,
765
+ # *txt2vid_advanced,
766
+ # ],
767
+ # outputs=txt2vid_output,
768
+ # concurrency_limit=1,
769
+ # concurrency_id="generate_video",
770
+ # queue=True,
771
+ # )
772
+
773
+ # img2vid_preset.change(fn=preset_changed, inputs=[img2vid_preset], outputs=img2vid_advanced[3:])
774
+
775
+ # img2vid_generate.click(
776
+ # fn=generate_video_from_image,
777
+ # inputs=[
778
+ # img2vid_image,
779
+ # img2vid_prompt,
780
+ # img2vid_enhance_toggle,
781
+ # img2vid_analytics_toggle,
782
+ # img2vid_negative_prompt,
783
+ # img2vid_frame_rate,
784
+ # *img2vid_advanced,
785
+ # ],
786
+ # outputs=img2vid_output,
787
+ # concurrency_limit=1,
788
+ # concurrency_id="generate_video",
789
+ # queue=True,
790
+ # )
791
+
792
+ # if __name__ == "__main__":
793
+ # iface.queue(max_size=64, default_concurrency_limit=1, api_open=True).launch(share=True, show_api=True)
794
+
795
  with gr.Blocks(theme=gr.themes.Soft()) as iface:
796
  with gr.Row(elem_id="title-row"):
797
  gr.Markdown(
 
801
  </div>
802
  """
803
  )
804
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
805
  with gr.Accordion(" 📖 Tips for Best Results", open=False, elem_id="instructions-accordion"):
806
  gr.Markdown(
807
  """
808
+ 📝 **Prompt Engineering**
809
+ When writing prompts, focus on detailed, chronological descriptions of actions and scenes.
810
+ For best results, structure your prompts as follows:
811
+ - Start with the main action in a single sentence
 
 
812
  - Add specific details about movements and gestures
813
  - Describe character/object appearances precisely
814
  - Include background and environment details
815
  - Specify camera angles and movements
816
+ - Describe lighting and colors
 
 
817
  See examples for more inspiration.
818
+ 🎮 **Parameter Guide**
819
+ - Resolution Preset: Higher resolutions for detailed scenes, lower for faster generation and simpler scenes
820
+ - Seed: Save seed values to recreate specific styles or compositions you like
821
+ - Guidance Scale: 3-3.5 are the recommended values
822
+ - Inference Steps: More steps (40+) for quality, fewer steps (20-30) for speed
 
 
823
  """
824
  )
825
 
826
  with gr.Tabs():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
827
  with gr.TabItem("Image to Video"):
828
  with gr.Row():
829
  with gr.Column():
 
838
  value="A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage.",
839
  lines=5,
840
  )
841
+ img2vid_analytics_toggle = gr.Checkbox(
842
  label="I agree to share my usage data anonymously to help improve the model features.",
843
  value=True,
844
  interactive=True,
845
  )
846
+ img2vid_enhance_toggle = gr.Checkbox(
847
  label="Enhance Prompt",
848
  value=False,
849
  interactive=True,
 
854
  value="low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
855
  lines=2,
856
  )
 
857
  img2vid_preset = gr.Dropdown(
858
+ choices=["768x512, 97 frames", "512x512, 50 frames"],
859
  value="768x512, 97 frames",
860
  label="Step 3.1: Choose Resolution Preset",
861
  )
 
862
  img2vid_frame_rate = gr.Slider(
863
  label="Step 3.2: Frame Rate",
864
  minimum=21,
 
866
  step=1,
867
  value=25,
868
  )
869
+ # Advanced options placeholder
870
+ img2vid_advanced = gr.Group() # Create advanced options later if needed
871
  img2vid_generate = gr.Button("Step 6: Generate Video", variant="primary", size="lg")
872
 
873
  with gr.Column():
874
  img2vid_output = gr.Video(label="Generated Output")
875
 
876
+ img2vid_preset.change(fn=preset_changed, inputs=[img2vid_preset], outputs=img2vid_advanced)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
877
 
878
  img2vid_generate.click(
879
  fn=generate_video_from_image,
 
884
  img2vid_analytics_toggle,
885
  img2vid_negative_prompt,
886
  img2vid_frame_rate,
887
+ img2vid_advanced,
888
  ],
889
  outputs=img2vid_output,
890
  concurrency_limit=1,
 
894
 
895
  if __name__ == "__main__":
896
  iface.queue(max_size=64, default_concurrency_limit=1, api_open=True).launch(share=True, show_api=True)
897
+