Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,15 +40,7 @@ def generate(prompt,
|
|
| 40 |
|
| 41 |
if image is not None or t2v:
|
| 42 |
condition1 = LTXVideoCondition(video=image, frame_index=0)
|
| 43 |
-
|
| 44 |
-
condition1 = None
|
| 45 |
-
|
| 46 |
-
# Part 1. Generate video at smaller resolution
|
| 47 |
-
# Text-only conditioning is also supported without the need to pass `conditions`
|
| 48 |
-
downscaled_height, downscaled_width = int(expected_height * downscale_factor), int(expected_width * downscale_factor)
|
| 49 |
-
downscaled_height, downscaled_width = round_to_nearest_resolution_acceptable_by_vae(downscaled_height, downscaled_width)
|
| 50 |
-
|
| 51 |
-
latents = pipe(
|
| 52 |
conditions=condition1,
|
| 53 |
prompt=prompt,
|
| 54 |
negative_prompt=negative_prompt,
|
|
@@ -61,6 +53,38 @@ def generate(prompt,
|
|
| 61 |
generator=torch.Generator().manual_seed(seed),
|
| 62 |
#output_type="latent",
|
| 63 |
).frames
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
# Part 2. Upscale generated video using latent upsampler with fewer inference steps
|
| 66 |
# The available latent upsampler upscales the height/width by 2x
|
|
|
|
| 40 |
|
| 41 |
if image is not None or t2v:
|
| 42 |
condition1 = LTXVideoCondition(video=image, frame_index=0)
|
| 43 |
+
latents = pipe(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
conditions=condition1,
|
| 45 |
prompt=prompt,
|
| 46 |
negative_prompt=negative_prompt,
|
|
|
|
| 53 |
generator=torch.Generator().manual_seed(seed),
|
| 54 |
#output_type="latent",
|
| 55 |
).frames
|
| 56 |
+
else:
|
| 57 |
+
latents = pipe(
|
| 58 |
+
prompt=prompt,
|
| 59 |
+
negative_prompt=negative_prompt,
|
| 60 |
+
# width=downscaled_width,
|
| 61 |
+
# height=downscaled_height,
|
| 62 |
+
num_frames=num_frames,
|
| 63 |
+
num_inference_steps=steps,
|
| 64 |
+
decode_timestep = 0.05,
|
| 65 |
+
decode_noise_scale = 0.025,
|
| 66 |
+
generator=torch.Generator().manual_seed(seed),
|
| 67 |
+
#output_type="latent",
|
| 68 |
+
).frames
|
| 69 |
+
|
| 70 |
+
# Part 1. Generate video at smaller resolution
|
| 71 |
+
# Text-only conditioning is also supported without the need to pass `conditions`
|
| 72 |
+
downscaled_height, downscaled_width = int(expected_height * downscale_factor), int(expected_width * downscale_factor)
|
| 73 |
+
downscaled_height, downscaled_width = round_to_nearest_resolution_acceptable_by_vae(downscaled_height, downscaled_width)
|
| 74 |
+
|
| 75 |
+
# latents = pipe(
|
| 76 |
+
# conditions=condition1,
|
| 77 |
+
# prompt=prompt,
|
| 78 |
+
# negative_prompt=negative_prompt,
|
| 79 |
+
# # width=downscaled_width,
|
| 80 |
+
# # height=downscaled_height,
|
| 81 |
+
# num_frames=num_frames,
|
| 82 |
+
# num_inference_steps=steps,
|
| 83 |
+
# decode_timestep = 0.05,
|
| 84 |
+
# decode_noise_scale = 0.025,
|
| 85 |
+
# generator=torch.Generator().manual_seed(seed),
|
| 86 |
+
# #output_type="latent",
|
| 87 |
+
# ).frames
|
| 88 |
|
| 89 |
# Part 2. Upscale generated video using latent upsampler with fewer inference steps
|
| 90 |
# The available latent upsampler upscales the height/width by 2x
|