Spaces:
Runtime error
Runtime error
Update app.py (#1)
Browse files- Update app.py (b3547a510c7a30c0995836463308ff6a98d90a1e)
- Update app.py (f41263642fc83451fae2692116077eac7746722b)
26 unmodified lines27282930313233343536373839401 unmodified line4243444546474849505152102 unmodified lines1551561571581591601611621636 unmodified lines17017117217317417517617717817918018118226 unmodified lines@spaces.GPUdef generate(prompt,negative_prompt,image,steps,num_frames,seed,randomize_seed,t2v, improve_texture=False, progress=gr.Progress(track_tqdm=True)):# Part 1. Generate video at smaller resolution# Text-only conditioning is also supported without the need to pass `conditions`expected_height, expected_width = 768, 11521 unmodified linedownscaled_height, downscaled_width = int(expected_height * downscale_factor), int(expected_width * downscale_factor)downscaled_height, downscaled_width = round_to_nearest_resolution_acceptable_by_vae(downscaled_height, downscaled_width)if randomize_seed:seed = random.randint(0, MAX_SEED)if image is not None or t2v:condition1 = LTXVideoCondition(video=image, frame_index=0)latents = pipe(conditions=condition1,prompt=prompt,102 unmodified lineswith gr.Row():with gr.Column():with 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)6 unmodified linesrandomize_seed = gr.Checkbox(label="randomize seed")with gr.Row():steps = gr.Slider(label="Steps", minimum=1, maximum=30, value=8, step=1)num_frames = gr.Slider(label="# frames", minimum=1, maximum=200, value=161, step=1)run_button.click(fn=generate,inputs=[prompt,negative_prompt,image,steps,num_frames,seed,26 unmodified lines27282930313233343536373839404142431 unmodified line454647484950515253545556575859102 unmodified lines1621631641651661671681691701711721731741751766 unmodified lines18318418518618718818919019119219319419519619726 unmodified lines@spaces.GPUdef generate(prompt,negative_prompt,image,video,steps,num_frames,seed,randomize_seed,t2v, improve_texture=False, progress=gr.Progress(track_tqdm=True)):if randomize_seed:seed = random.randint(0, MAX_SEED)# Part 1. Generate video at smaller resolution# Text-only conditioning is also supported without the need to pass `conditions`expected_height, expected_width = 768, 11521 unmodified linedownscaled_height, downscaled_width = int(expected_height * downscale_factor), int(expected_width * downscale_factor)downscaled_height, downscaled_width = round_to_nearest_resolution_acceptable_by_vae(downscaled_height, downscaled_width)condition = image is not None or video is not Noneif video:frames_to_use = 21video = load_video(video)[:frames_to_use]else:video = [image]if condition and (not t2v):condition1 = LTXVideoCondition(video=video, frame_index=0)latents = pipe(conditions=condition1,prompt=prompt,102 unmodified lineswith gr.Row():with gr.Column():with gr.Group():with gr.Tab("text-to-video"):image = gr.Image(label="", visible=False)#prompt = gr.Textbox(label="prompt")with gr.Tab("image-to-video"):image = gr.Image(label="")#prompt = gr.Textbox(label="prompt")with gr.Tab("video-to-video"):video = gr.Video(label="")prompt = gr.Textbox(label="prompt")run_button = gr.Button()with gr.Column():output = gr.Video(interactive=False)6 unmodified linesrandomize_seed = gr.Checkbox(label="randomize seed")with gr.Row():steps = gr.Slider(label="Steps", minimum=1, maximum=30, value=8, step=1)num_frames = gr.Slider(label="# frames", minimum=1, maximum=30, value=8, step=1)run_button.click(fn=generate,inputs=[prompt,negative_prompt,image,video,steps,num_frames,seed,
app.py+25-10