linoyts HF Staff commited on
Commit
f412636
·
verified ·
1 Parent(s): b3547a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -46,9 +46,14 @@ def generate(prompt,
46
  downscaled_height, downscaled_width = round_to_nearest_resolution_acceptable_by_vae(downscaled_height, downscaled_width)
47
 
48
  condition = image is not None or video is not None
 
 
 
 
 
49
 
50
  if condition and (not t2v):
51
- condition1 = LTXVideoCondition(video=[image], frame_index=0)
52
  latents = pipe(
53
  conditions=condition1,
54
  prompt=prompt,
@@ -164,7 +169,7 @@ with gr.Blocks(css=css, theme=gr.themes.Ocean()) as demo:
164
  image = gr.Image(label="")
165
  #prompt = gr.Textbox(label="prompt")
166
  with gr.Tab("video-to-video"):
167
- image = gr.Video(label="")
168
  prompt = gr.Textbox(label="prompt")
169
  run_button = gr.Button()
170
  with gr.Column():
 
46
  downscaled_height, downscaled_width = round_to_nearest_resolution_acceptable_by_vae(downscaled_height, downscaled_width)
47
 
48
  condition = image is not None or video is not None
49
+ if video:
50
+ frames_to_use = 21
51
+ video = load_video(video)[:frames_to_use]
52
+ else:
53
+ video = [image]
54
 
55
  if condition and (not t2v):
56
+ condition1 = LTXVideoCondition(video=video, frame_index=0)
57
  latents = pipe(
58
  conditions=condition1,
59
  prompt=prompt,
 
169
  image = gr.Image(label="")
170
  #prompt = gr.Textbox(label="prompt")
171
  with gr.Tab("video-to-video"):
172
+ video = gr.Video(label="")
173
  prompt = gr.Textbox(label="prompt")
174
  run_button = gr.Button()
175
  with gr.Column():