Spaces:
Runtime error
Runtime error
Update app.py
Browse files10 unmodified lines1112131415167 unmodified lines2425262728293031323334357 unmodified lines43444546474849504 unmodified lines5556575859606150 unmodified lines11211311411511611716 unmodified lines13413513613713813914010 unmodified linespipe_upsample.to("cuda")pipe.vae.enable_tiling()def round_to_nearest_resolution_acceptable_by_vae(height, width):height = height - (height % pipe.vae_temporal_compression_ratio)7 unmodified linessteps,num_frames,seed,randomize_seed):expected_height, expected_width = 768, 1152downscale_factor = 2 / 3if image is not None:condition1 = LTXVideoCondition(video=image, frame_index=0)else:condition1 = None7 unmodified linesconditions=condition1,prompt=prompt,negative_prompt=negative_prompt,width=downscaled_width,height=downscaled_height,num_frames=num_frames,num_inference_steps=steps,decode_timestep = 0.05,4 unmodified lines# Part 2. Upscale generated video using latent upsampler with fewer inference steps# The available latent upsampler upscales the height/width by 2xupscaled_height, upscaled_width = downscaled_height * 2, downscaled_width * 2# upscaled_latents = pipe_upsample(# latents=latents,# output_type="latent"50 unmodified lineswith gr.Group():image = gr.Image(label="")prompt = gr.Textbox(label="prompt")run_button = gr.Button()with gr.Column():output = gr.Video(interactive=False)16 unmodified linessteps,num_frames,seed,randomize_seed],outputs=[output])10 unmodified lines1112131415161718197 unmodified lines272829303132333435363738394041427 unmodified lines50515253545556574 unmodified lines6263646566676850 unmodified lines11912012112212312412516 unmodified lines14214314414514614714810 unmodified linespipe_upsample.to("cuda")pipe.vae.enable_tiling()MAX_SEED = np.iinfo(np.int32).maxMAX_IMAGE_SIZE = 2048def round_to_nearest_resolution_acceptable_by_vae(height, width):height = height - (height % pipe.vae_temporal_compression_ratio)7 unmodified linessteps,num_frames,seed,randomize_seed,t2v, progress=gr.Progress(track_tqdm=True)):expected_height, expected_width = 768, 1152downscale_factor = 2 / 3if randomize_seed:seed = random.randint(0, MAX_SEED)if image is not None or t2v:condition1 = LTXVideoCondition(video=image, frame_index=0)else:condition1 = None7 unmodified linesconditions=condition1,prompt=prompt,negative_prompt=negative_prompt,# width=downscaled_width,# height=downscaled_height,num_frames=num_frames,num_inference_steps=steps,decode_timestep = 0.05,4 unmodified lines# Part 2. Upscale generated video using latent upsampler with fewer inference steps# The available latent upsampler upscales the height/width by 2x# upscaled_height, upscaled_width = downscaled_height * 2, downscaled_width * 2# upscaled_latents = pipe_upsample(# latents=latents,# output_type="latent"50 unmodified lineswith gr.Group():image = gr.Image(label="")prompt = gr.Textbox(label="prompt")t2v = gr.Checkbox(label="run text-to-video", value=False)run_button = gr.Button()with gr.Column():output = gr.Video(interactive=False)16 unmodified linessteps,num_frames,seed,randomize_seed, t2v],outputs=[output])
app.py+14-6