openfree commited on
Commit
efaee2f
·
verified ·
1 Parent(s): 7a7e12d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -8
app.py CHANGED
@@ -101,6 +101,12 @@ def enhance_prompt(prompt, type="t2v"):
101
  print(f"Error during prompt enhancement: {e}")
102
  return prompt
103
 
 
 
 
 
 
 
104
  def update_prompt(prompt, enhance_toggle, type="t2v"):
105
  if enhance_toggle:
106
  return enhance_prompt(prompt, type)
@@ -611,15 +617,17 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
611
  )
612
 
613
  # Event handlers
 
614
  txt2vid_preset.change(
615
- fn=preset_changed, inputs=[txt2vid_preset], outputs=txt2vid_advanced[3:]
 
 
616
  )
617
 
618
  txt2vid_enhance_toggle.change(
619
- fn=update_prompt,
620
  inputs=[txt2vid_prompt, txt2vid_enhance_toggle],
621
- outputs=txt2vid_prompt,
622
- kwargs={"type": "t2v"}
623
  )
624
 
625
  txt2vid_generate.click(
@@ -638,14 +646,15 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
638
  )
639
 
640
  img2vid_preset.change(
641
- fn=preset_changed, inputs=[img2vid_preset], outputs=img2vid_advanced[3:]
 
 
642
  )
643
 
644
  img2vid_enhance_toggle.change(
645
- fn=update_prompt,
646
  inputs=[img2vid_prompt, img2vid_enhance_toggle],
647
- outputs=img2vid_prompt,
648
- kwargs={"type": "i2v"}
649
  )
650
 
651
  img2vid_generate.click(
 
101
  print(f"Error during prompt enhancement: {e}")
102
  return prompt
103
 
104
+ def update_prompt_t2v(prompt, enhance_toggle):
105
+ return update_prompt(prompt, enhance_toggle, "t2v")
106
+
107
+ def update_prompt_i2v(prompt, enhance_toggle):
108
+ return update_prompt(prompt, enhance_toggle, "i2v")
109
+
110
  def update_prompt(prompt, enhance_toggle, type="t2v"):
111
  if enhance_toggle:
112
  return enhance_prompt(prompt, type)
 
617
  )
618
 
619
  # Event handlers
620
+ # Event handlers
621
  txt2vid_preset.change(
622
+ fn=preset_changed,
623
+ inputs=[txt2vid_preset],
624
+ outputs=txt2vid_advanced[3:]
625
  )
626
 
627
  txt2vid_enhance_toggle.change(
628
+ fn=update_prompt_t2v,
629
  inputs=[txt2vid_prompt, txt2vid_enhance_toggle],
630
+ outputs=txt2vid_prompt
 
631
  )
632
 
633
  txt2vid_generate.click(
 
646
  )
647
 
648
  img2vid_preset.change(
649
+ fn=preset_changed,
650
+ inputs=[img2vid_preset],
651
+ outputs=img2vid_advanced[3:]
652
  )
653
 
654
  img2vid_enhance_toggle.change(
655
+ fn=update_prompt_i2v,
656
  inputs=[img2vid_prompt, img2vid_enhance_toggle],
657
+ outputs=img2vid_prompt
 
658
  )
659
 
660
  img2vid_generate.click(