Fabrice-TIERCELIN commited on
Commit
1bd869c
·
verified ·
1 Parent(s): 27fea43

Generation mode

Browse files
Files changed (1) hide show
  1. app_start_end.py +19 -3
app_start_end.py CHANGED
@@ -1390,7 +1390,7 @@ with block:
1390
  local_storage = gr.BrowserState(default_local_storage)
1391
  with gr.Row():
1392
  with gr.Column():
1393
- generation_mode = gr.Radio([["Text-to-Video", "text"], ["Image-to-Video", "image"], ["Start frame & End frame", "start_end"], ["Video Extension", "video"]], elem_id="generation-mode", label="Generation mode", value = "image")
1394
  text_to_video_hint = gr.HTML("Text-to-Video badly works with a flash effect at the start. I discourage to use the Text-to-Video feature. You should rather generate an image with Flux and use Image-to-Video. You will save time.")
1395
  input_image = gr.Image(sources='upload', type="numpy", label="Image", height=320)
1396
  end_image = gr.Image(sources='upload', type="numpy", label="End Frame (Optional)", height=320)
@@ -2006,9 +2006,25 @@ with block:
2006
 
2007
  def handle_generation_mode_change(generation_mode_data):
2008
  if generation_mode_data == "text":
2009
- return [gr.update(visible = True), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = True), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = True)]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2010
  elif generation_mode_data == "image":
2011
- return [gr.update(visible = False), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = False), gr.update(visible = True), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = True)]
 
 
2012
  elif generation_mode_data == "video":
2013
  return [gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = True), gr.update(visible = False), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = False)]
2014
 
 
1390
  local_storage = gr.BrowserState(default_local_storage)
1391
  with gr.Row():
1392
  with gr.Column():
1393
+ generation_mode = gr.Radio([["Text-to-Video", "text"], ["Image-to-Video", "image"], ["Start & end frames", "start_end"], ["Video Extension", "video"]], elem_id="generation-mode", label="Generation mode", value = "image")
1394
  text_to_video_hint = gr.HTML("Text-to-Video badly works with a flash effect at the start. I discourage to use the Text-to-Video feature. You should rather generate an image with Flux and use Image-to-Video. You will save time.")
1395
  input_image = gr.Image(sources='upload', type="numpy", label="Image", height=320)
1396
  end_image = gr.Image(sources='upload', type="numpy", label="End Frame (Optional)", height=320)
 
2006
 
2007
  def handle_generation_mode_change(generation_mode_data):
2008
  if generation_mode_data == "text":
2009
+ return [
2010
+ gr.update(visible = True), # text_to_video_hint
2011
+ gr.update(visible = False), # image_position
2012
+ gr.update(visible = False), # input_image
2013
+ gr.update(visible = False), # end_image
2014
+ gr.update(visible = False), # input_video
2015
+ gr.update(visible = True), # start_button
2016
+ gr.update(visible = False), # start_button_video
2017
+ gr.update(visible = False), # no_resize
2018
+ gr.update(visible = False), # batch
2019
+ gr.update(visible = False), # num_clean_frames
2020
+ gr.update(visible = False), # vae_batch
2021
+ gr.update(visible = False), # prompt_hint
2022
+ gr.update(visible = True) # fps_number
2023
+ ]
2024
  elif generation_mode_data == "image":
2025
+ return [gr.update(visible = False), gr.update(visible = True), gr.update(visible = True), gr.update(visible = False), gr.update(visible = False), gr.update(visible = True), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = True)]
2026
+ elif generation_mode_data == "start_end":
2027
+ return [gr.update(visible = False), gr.update(visible = False), gr.update(visible = True), gr.update(visible = True), gr.update(visible = False), gr.update(visible = True), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = True)]
2028
  elif generation_mode_data == "video":
2029
  return [gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = True), gr.update(visible = False), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = False)]
2030