dagloop5 commited on
Commit
d27af4b
·
verified ·
1 Parent(s): 957cec5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -3
app.py CHANGED
@@ -573,7 +573,26 @@ def on_highres_toggle(first_image, last_image, high_res):
573
  return gr.update(value=w), gr.update(value=h)
574
 
575
 
576
- @spaces.GPU(duration=105)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  @torch.inference_mode()
578
  def generate_video(
579
  first_image,
@@ -581,6 +600,7 @@ def generate_video(
581
  input_audio,
582
  prompt: str,
583
  duration: float,
 
584
  enhance_prompt: bool = True,
585
  seed: int = 42,
586
  randomize_seed: bool = True,
@@ -712,6 +732,13 @@ with gr.Blocks(title="LTX-2.3 Heretic Distilled") as demo:
712
 
713
  with gr.Column():
714
  output_video = gr.Video(label="Generated Video", autoplay=False)
 
 
 
 
 
 
 
715
 
716
  gr.Examples(
717
  examples=[
@@ -726,6 +753,7 @@ with gr.Blocks(title="LTX-2.3 Heretic Distilled") as demo:
726
  "crowd together closely, forming a symmetrical cluster while staring "
727
  "directly into the lens.",
728
  3.0,
 
729
  False,
730
  42,
731
  True,
@@ -737,7 +765,7 @@ with gr.Blocks(title="LTX-2.3 Heretic Distilled") as demo:
737
  ],
738
  ],
739
  inputs=[
740
- first_image, last_image, input_audio, prompt, duration,
741
  enhance_prompt, seed, randomize_seed, height, width,
742
  pose_strength, general_strength, motion_strength,
743
  ],
@@ -764,7 +792,7 @@ with gr.Blocks(title="LTX-2.3 Heretic Distilled") as demo:
764
  generate_btn.click(
765
  fn=generate_video,
766
  inputs=[
767
- first_image, last_image, input_audio, prompt, duration, enhance_prompt,
768
  seed, randomize_seed, height, width,
769
  pose_strength, general_strength, motion_strength,
770
  ],
 
573
  return gr.update(value=w), gr.update(value=h)
574
 
575
 
576
+ def get_gpu_duration(
577
+ first_image,
578
+ last_image,
579
+ input_audio,
580
+ prompt: str,
581
+ duration: float,
582
+ gpu_duration: float,
583
+ enhance_prompt: bool = True,
584
+ seed: int = 42,
585
+ randomize_seed: bool = True,
586
+ height: int = 1024,
587
+ width: int = 1536,
588
+ pose_strength: float = 0.0,
589
+ general_strength: float = 0.0,
590
+ motion_strength: float = 0.0,
591
+ progress=None,
592
+ ):
593
+ return int(gpu_duration)
594
+
595
+ @spaces.GPU(duration=get_gpu_duration)
596
  @torch.inference_mode()
597
  def generate_video(
598
  first_image,
 
600
  input_audio,
601
  prompt: str,
602
  duration: float,
603
+ gpu_duration: float,
604
  enhance_prompt: bool = True,
605
  seed: int = 42,
606
  randomize_seed: bool = True,
 
732
 
733
  with gr.Column():
734
  output_video = gr.Video(label="Generated Video", autoplay=False)
735
+ gpu_duration = gr.Slider(
736
+ label="ZeroGPU duration (seconds)",
737
+ minimum=40.0,
738
+ maximum=240.0,
739
+ value=85.0,
740
+ step=1.0,
741
+ )
742
 
743
  gr.Examples(
744
  examples=[
 
753
  "crowd together closely, forming a symmetrical cluster while staring "
754
  "directly into the lens.",
755
  3.0,
756
+ 80.0,
757
  False,
758
  42,
759
  True,
 
765
  ],
766
  ],
767
  inputs=[
768
+ first_image, last_image, input_audio, prompt, duration, gpu_duration,
769
  enhance_prompt, seed, randomize_seed, height, width,
770
  pose_strength, general_strength, motion_strength,
771
  ],
 
792
  generate_btn.click(
793
  fn=generate_video,
794
  inputs=[
795
+ first_image, last_image, input_audio, prompt, duration, gpu_duration, enhance_prompt,
796
  seed, randomize_seed, height, width,
797
  pose_strength, general_strength, motion_strength,
798
  ],