Fabrice-TIERCELIN commited on
Commit
2f73335
·
verified ·
1 Parent(s): 28a02ed
Files changed (1) hide show
  1. app.py +29 -0
app.py CHANGED
@@ -24,6 +24,8 @@ from inference import (
24
  from ltx_video.pipelines.pipeline_ltx_video import ConditioningItem, LTXMultiScalePipeline, LTXVideoPipeline
25
  from ltx_video.utils.skip_layer_strategy import SkipLayerStrategy
26
 
 
 
27
  config_file_path = "configs/ltxv-13b-0.9.7-distilled.yaml"
28
  with open(config_file_path, "r") as file:
29
  PIPELINE_CONFIG_YAML = yaml.safe_load(file)
@@ -148,6 +150,12 @@ def generate(prompt, negative_prompt, input_image_filepath, input_video_filepath
148
  seed_ui, randomize_seed, ui_guidance_scale, improve_texture_flag,
149
  progress=gr.Progress(track_tqdm=True)):
150
 
 
 
 
 
 
 
151
  if randomize_seed:
152
  seed_ui = random.randint(0, 2**32 - 1)
153
  seed_everething(int(seed_ui))
@@ -376,6 +384,8 @@ with gr.Blocks(css=css) as demo:
376
  # gr.DeepLinkButton()
377
 
378
  with gr.Accordion("Advanced settings", open=False):
 
 
379
  mode = gr.Dropdown(["text-to-video", "image-to-video", "video-to-video"], label="task", value="image-to-video", visible=False)
380
  negative_prompt_input = gr.Textbox(label="Negative Prompt", value="worst quality, inconsistent motion, blurry, jittery, distorted", lines=2)
381
  with gr.Row():
@@ -413,8 +423,17 @@ with gr.Blocks(css=css) as demo:
413
  seed_input, randomize_seed_input, guidance_scale_input, improve_texture],
414
  outputs = [output_video, seed_input],
415
  cache_examples = True,
 
416
  )
417
 
 
 
 
 
 
 
 
 
418
  # --- Event handlers for updating dimensions on upload ---
419
  def handle_image_upload_for_dims(image_filepath, current_h, current_w):
420
  if not image_filepath: # Image cleared or no image initially
@@ -477,6 +496,16 @@ with gr.Blocks(css=css) as demo:
477
  inputs=[video_v2v, height_input, width_input],
478
  outputs=[height_input, width_input]
479
  )
 
 
 
 
 
 
 
 
 
 
480
 
481
  image_tab.select(
482
  fn=update_task_image,
 
24
  from ltx_video.pipelines.pipeline_ltx_video import ConditioningItem, LTXMultiScalePipeline, LTXVideoPipeline
25
  from ltx_video.utils.skip_layer_strategy import SkipLayerStrategy
26
 
27
+ image_i2v_debug_value = None
28
+ i2v_prompt_debug_value = None
29
  config_file_path = "configs/ltxv-13b-0.9.7-distilled.yaml"
30
  with open(config_file_path, "r") as file:
31
  PIPELINE_CONFIG_YAML = yaml.safe_load(file)
 
150
  seed_ui, randomize_seed, ui_guidance_scale, improve_texture_flag,
151
  progress=gr.Progress(track_tqdm=True)):
152
 
153
+ if i2v_prompt_debug_value is not None:
154
+ prompt = i2v_prompt_debug_value
155
+
156
+ if image_i2v_debug_value is not None:
157
+ input_image_filepath = image_i2v_debug_value
158
+
159
  if randomize_seed:
160
  seed_ui = random.randint(0, 2**32 - 1)
161
  seed_everething(int(seed_ui))
 
384
  # gr.DeepLinkButton()
385
 
386
  with gr.Accordion("Advanced settings", open=False):
387
+ image_i2v_debug = gr.Image(label="Input Image Debug", type="filepath", sources=["upload", "webcam", "clipboard"])
388
+ i2v_prompt_debug = gr.Textbox(label="Prompt Debug", value="", lines=3)
389
  mode = gr.Dropdown(["text-to-video", "image-to-video", "video-to-video"], label="task", value="image-to-video", visible=False)
390
  negative_prompt_input = gr.Textbox(label="Negative Prompt", value="worst quality, inconsistent motion, blurry, jittery, distorted", lines=2)
391
  with gr.Row():
 
423
  seed_input, randomize_seed_input, guidance_scale_input, improve_texture],
424
  outputs = [output_video, seed_input],
425
  cache_examples = True,
426
+ visible=False,
427
  )
428
 
429
+ def image_i2v_debug_upload(image_filepath):
430
+ image_i2v_debug_value = image_filepath
431
+ return []
432
+
433
+ def i2v_prompt_debug_change(prompt):
434
+ i2v_prompt_debug_value = prompt
435
+ return []
436
+
437
  # --- Event handlers for updating dimensions on upload ---
438
  def handle_image_upload_for_dims(image_filepath, current_h, current_w):
439
  if not image_filepath: # Image cleared or no image initially
 
496
  inputs=[video_v2v, height_input, width_input],
497
  outputs=[height_input, width_input]
498
  )
499
+ image_i2v_debug.upload(
500
+ fn=image_i2v_debug_upload,
501
+ inputs=[image_i2v_debug],
502
+ outputs=[]
503
+ )
504
+ i2v_prompt_debug.change(
505
+ fn=i2v_prompt_debug_change,
506
+ inputs=[image_i2v_debug],
507
+ outputs=[]
508
+ )
509
 
510
  image_tab.select(
511
  fn=update_task_image,