Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -106,8 +106,36 @@ RESOLUTIONS = {
|
|
| 106 |
}
|
| 107 |
|
| 108 |
|
| 109 |
-
class LTX23DistilledA2VPipeline
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
def __call__(
|
| 113 |
self,
|
|
@@ -118,24 +146,10 @@ class LTX23DistilledA2VPipeline(DistilledPipeline):
|
|
| 118 |
num_frames: int,
|
| 119 |
frame_rate: float,
|
| 120 |
images: list[ImageConditioningInput],
|
| 121 |
-
audio_path: str | None = None,
|
| 122 |
tiling_config: TilingConfig | None = None,
|
| 123 |
enhance_prompt: bool = False,
|
| 124 |
):
|
| 125 |
-
# Standard path when no audio input is provided.
|
| 126 |
print(prompt)
|
| 127 |
-
if audio_path is None:
|
| 128 |
-
return super().__call__(
|
| 129 |
-
prompt=prompt,
|
| 130 |
-
seed=seed,
|
| 131 |
-
height=height,
|
| 132 |
-
width=width,
|
| 133 |
-
num_frames=num_frames,
|
| 134 |
-
frame_rate=frame_rate,
|
| 135 |
-
images=images,
|
| 136 |
-
tiling_config=tiling_config,
|
| 137 |
-
enhance_prompt=enhance_prompt,
|
| 138 |
-
)
|
| 139 |
|
| 140 |
generator = torch.Generator(device=self.device).manual_seed(seed)
|
| 141 |
noiser = GaussianNoiser(generator=generator)
|
|
@@ -151,9 +165,6 @@ class LTX23DistilledA2VPipeline(DistilledPipeline):
|
|
| 151 |
video_context, audio_context = ctx_p.video_encoding, ctx_p.audio_encoding
|
| 152 |
|
| 153 |
video_duration = num_frames / frame_rate
|
| 154 |
-
decoded_audio = decode_audio_from_file(audio_path, self.device, 0.0, video_duration)
|
| 155 |
-
if decoded_audio is None:
|
| 156 |
-
raise ValueError(f"Could not extract audio stream from {audio_path}")
|
| 157 |
|
| 158 |
encoded_audio_latent = vae_encode_audio(decoded_audio, self.model_ledger.audio_encoder())
|
| 159 |
audio_shape = AudioLatentShape.from_duration(batch=1, duration=video_duration, channels=8, mel_bins=16)
|
|
@@ -262,18 +273,17 @@ class LTX23DistilledA2VPipeline(DistilledPipeline):
|
|
| 262 |
tiling_config,
|
| 263 |
generator,
|
| 264 |
)
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
|
|
|
| 268 |
)
|
| 269 |
-
return decoded_video,
|
| 270 |
|
| 271 |
|
| 272 |
# Model repos
|
| 273 |
LTX_MODEL_REPO = "Lightricks/LTX-2.3"
|
| 274 |
GEMMA_REPO ="Lightricks/gemma-3-12b-it-qat-q4_0-unquantized"
|
| 275 |
-
GEMMA_ABLITERATED_REPO = "Sikaworld1990/gemma-3-12b-it-abliterated-sikaworld-high-fidelity-edition-Ltx-2"
|
| 276 |
-
GEMMA_ABLITERATED_FILE = "gemma-3-12b-it-abliterated-sikaworld-high-fidelity-edition.safetensors"
|
| 277 |
|
| 278 |
# Download model checkpoints
|
| 279 |
print("=" * 80)
|
|
@@ -297,73 +307,6 @@ checkpoint_path = hf_hub_download(
|
|
| 297 |
local_dir=str(weights_dir),
|
| 298 |
local_dir_use_symlinks=False,
|
| 299 |
)
|
| 300 |
-
|
| 301 |
-
print("[Gemma] Setting up abliterated Gemma text encoder...")
|
| 302 |
-
MERGED_WEIGHTS = "/tmp/abliterated_gemma_merged.safetensors"
|
| 303 |
-
gemma_root = "/tmp/abliterated_gemma"
|
| 304 |
-
os.makedirs(gemma_root, exist_ok=True)
|
| 305 |
-
|
| 306 |
-
gemma_official_dir = snapshot_download(
|
| 307 |
-
repo_id=GEMMA_REPO,
|
| 308 |
-
ignore_patterns=["*.safetensors", "*.safetensors.index.json"],
|
| 309 |
-
)
|
| 310 |
-
|
| 311 |
-
for fname in os.listdir(gemma_official_dir):
|
| 312 |
-
src = os.path.join(gemma_official_dir, fname)
|
| 313 |
-
dst = os.path.join(gemma_root, fname)
|
| 314 |
-
if os.path.isfile(src) and not fname.endswith(".safetensors") and fname != "model.safetensors.index.json":
|
| 315 |
-
if not os.path.exists(dst):
|
| 316 |
-
os.symlink(src, dst)
|
| 317 |
-
|
| 318 |
-
if os.path.exists(MERGED_WEIGHTS):
|
| 319 |
-
print("[Gemma] Using cached merged weights")
|
| 320 |
-
else:
|
| 321 |
-
abliterated_weights_path = hf_hub_download(
|
| 322 |
-
repo_id=GEMMA_ABLITERATED_REPO,
|
| 323 |
-
filename=GEMMA_ABLITERATED_FILE,
|
| 324 |
-
)
|
| 325 |
-
index_path = hf_hub_download(
|
| 326 |
-
repo_id=GEMMA_REPO,
|
| 327 |
-
filename="model.safetensors.index.json"
|
| 328 |
-
)
|
| 329 |
-
with open(index_path) as f:
|
| 330 |
-
weight_index = json.load(f)
|
| 331 |
-
|
| 332 |
-
vision_keys = {}
|
| 333 |
-
for key, shard in weight_index["weight_map"].items():
|
| 334 |
-
if "vision_tower" in key or "multi_modal_projector" in key:
|
| 335 |
-
vision_keys[key] = shard
|
| 336 |
-
needed_shards = set(vision_keys.values())
|
| 337 |
-
|
| 338 |
-
shard_paths = {}
|
| 339 |
-
for shard_name in needed_shards:
|
| 340 |
-
shard_paths[shard_name] = hf_hub_download(
|
| 341 |
-
repo_id=GEMMA_REPO,
|
| 342 |
-
filename=shard_name
|
| 343 |
-
)
|
| 344 |
-
|
| 345 |
-
_fp8_types = {torch.float8_e4m3fn, torch.float8_e5m2}
|
| 346 |
-
raw = load_file(abliterated_weights_path)
|
| 347 |
-
merged = {}
|
| 348 |
-
for key, tensor in raw.items():
|
| 349 |
-
t = tensor.to(torch.bfloat16) if tensor.dtype in _fp8_types else tensor
|
| 350 |
-
merged[f"language_model.{key}"] = t
|
| 351 |
-
del raw
|
| 352 |
-
|
| 353 |
-
for key, shard_name in vision_keys.items():
|
| 354 |
-
with safe_open(shard_paths[shard_name], framework="pt") as f:
|
| 355 |
-
merged[key] = f.get_tensor(key)
|
| 356 |
-
|
| 357 |
-
save_file(merged, MERGED_WEIGHTS)
|
| 358 |
-
del merged
|
| 359 |
-
gc.collect()
|
| 360 |
-
|
| 361 |
-
weight_link = os.path.join(gemma_root, "model.safetensors")
|
| 362 |
-
if os.path.exists(weight_link):
|
| 363 |
-
os.remove(weight_link)
|
| 364 |
-
os.symlink(MERGED_WEIGHTS, weight_link)
|
| 365 |
-
print(f"[Gemma] Root ready: {gemma_root}")
|
| 366 |
-
|
| 367 |
spatial_upsampler_path = hf_hub_download(repo_id=LTX_MODEL_REPO, filename="ltx-2.3-spatial-upscaler-x2-1.1.safetensors")
|
| 368 |
gemma_root = snapshot_download(repo_id=GEMMA_REPO)
|
| 369 |
|
|
@@ -381,7 +324,7 @@ motion_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="motion_helper.sa
|
|
| 381 |
dreamlay_lora_path = hf_hub_download(repo_id="lynaNSFW/DR34ML4Y_AIO_NSFW_LTX23", filename="DR34ML4Y_LTXXX_V2.safetensors") # m15510n4ry, bl0wj0b, d0ubl3_bj, d0gg1e, c0wg1rl
|
| 382 |
mself_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="Furry Hyper Masturbation - LTX-2 I2V v1.safetensors") # Hyperfap
|
| 383 |
dramatic_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX-2.3 - Orgasm.safetensors") # "[He | She] is having am orgasm." (am or an?)
|
| 384 |
-
fluid_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="
|
| 385 |
liquid_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="liquid_wet_dr1pp_ltx2_v1.0_scaled.safetensors") # wet dr1pp
|
| 386 |
demopose_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="clapping-cheeks-audio-v001-alpha.safetensors")
|
| 387 |
voice_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="hentai_voice_ltx23.safetensors")
|
|
@@ -597,9 +540,8 @@ ledger = pipeline.model_ledger
|
|
| 597 |
# Save the original factory methods so we can rebuild individual components later.
|
| 598 |
# These are bound callables on ledger that will call the builder when invoked.
|
| 599 |
_orig_transformer_factory = ledger.transformer
|
| 600 |
-
_orig_video_encoder_factory = ledger.
|
| 601 |
_orig_video_decoder_factory = ledger.video_decoder
|
| 602 |
-
_orig_audio_encoder_factory = ledger.audio_encoder
|
| 603 |
_orig_audio_decoder_factory = ledger.audio_decoder
|
| 604 |
_orig_vocoder_factory = ledger.vocoder
|
| 605 |
_orig_spatial_upsampler_factory = ledger.spatial_upsampler
|
|
@@ -610,7 +552,6 @@ _orig_gemma_embeddings_factory = ledger.gemma_embeddings_processor
|
|
| 610 |
_transformer = _orig_transformer_factory()
|
| 611 |
_video_encoder = _orig_video_encoder_factory()
|
| 612 |
_video_decoder = _orig_video_decoder_factory()
|
| 613 |
-
_audio_encoder = _orig_audio_encoder_factory()
|
| 614 |
_audio_decoder = _orig_audio_decoder_factory()
|
| 615 |
_vocoder = _orig_vocoder_factory()
|
| 616 |
_spatial_upsampler = _orig_spatial_upsampler_factory()
|
|
@@ -622,7 +563,6 @@ _embeddings_processor = _orig_gemma_embeddings_factory()
|
|
| 622 |
ledger.transformer = lambda: _transformer
|
| 623 |
ledger.video_encoder = lambda: _video_encoder
|
| 624 |
ledger.video_decoder = lambda: _video_decoder
|
| 625 |
-
ledger.audio_encoder = lambda: _audio_encoder
|
| 626 |
ledger.audio_decoder = lambda: _audio_decoder
|
| 627 |
ledger.vocoder = lambda: _vocoder
|
| 628 |
ledger.spatial_upsampler = lambda: _spatial_upsampler
|
|
@@ -678,7 +618,6 @@ def on_highres_toggle(first_image, last_image, high_res):
|
|
| 678 |
def get_gpu_duration(
|
| 679 |
first_image,
|
| 680 |
last_image,
|
| 681 |
-
input_audio,
|
| 682 |
prompt: str,
|
| 683 |
duration: float = 0.0,
|
| 684 |
gpu_duration: float = 0.0,
|
|
@@ -711,7 +650,6 @@ def get_gpu_duration(
|
|
| 711 |
def generate_video(
|
| 712 |
first_image,
|
| 713 |
last_image,
|
| 714 |
-
input_audio,
|
| 715 |
prompt: str,
|
| 716 |
duration: float = 0.0,
|
| 717 |
gpu_duration: float = 0.0,
|
|
@@ -784,7 +722,6 @@ def generate_video(
|
|
| 784 |
num_frames=num_frames,
|
| 785 |
frame_rate=frame_rate,
|
| 786 |
images=images,
|
| 787 |
-
audio_path=input_audio,
|
| 788 |
tiling_config=tiling_config,
|
| 789 |
enhance_prompt=enhance_prompt,
|
| 790 |
)
|
|
@@ -819,7 +756,6 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 819 |
with gr.Row():
|
| 820 |
first_image = gr.Image(label="First Frame (Optional)", type="pil")
|
| 821 |
last_image = gr.Image(label="Last Frame (Optional)", type="pil")
|
| 822 |
-
input_audio = gr.Audio(label="Audio Input (Optional)", type="filepath")
|
| 823 |
prompt = gr.Textbox(
|
| 824 |
label="Prompt",
|
| 825 |
info="for best results - make it as elaborate as possible",
|
|
@@ -920,49 +856,6 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 920 |
step=1.0,
|
| 921 |
)
|
| 922 |
|
| 923 |
-
gr.Examples(
|
| 924 |
-
examples=[
|
| 925 |
-
[
|
| 926 |
-
None,
|
| 927 |
-
"pinkknit.jpg",
|
| 928 |
-
None,
|
| 929 |
-
"The camera falls downward through darkness as if dropped into a tunnel. "
|
| 930 |
-
"As it slows, five friends wearing pink knitted hats and sunglasses lean "
|
| 931 |
-
"over and look down toward the camera with curious expressions. The lens "
|
| 932 |
-
"has a strong fisheye effect, creating a circular frame around them. They "
|
| 933 |
-
"crowd together closely, forming a symmetrical cluster while staring "
|
| 934 |
-
"directly into the lens.",
|
| 935 |
-
3.0,
|
| 936 |
-
80.0,
|
| 937 |
-
False,
|
| 938 |
-
42,
|
| 939 |
-
True,
|
| 940 |
-
1024,
|
| 941 |
-
1024,
|
| 942 |
-
0.0, # pose_strength (example)
|
| 943 |
-
0.0, # general_strength (example)
|
| 944 |
-
0.0, # motion_strength (example)
|
| 945 |
-
0.0,
|
| 946 |
-
0.0,
|
| 947 |
-
0.0,
|
| 948 |
-
0.0,
|
| 949 |
-
0.0,
|
| 950 |
-
0.0,
|
| 951 |
-
0.0,
|
| 952 |
-
0.0,
|
| 953 |
-
0.0,
|
| 954 |
-
0.0,
|
| 955 |
-
0.0,
|
| 956 |
-
0.0,
|
| 957 |
-
],
|
| 958 |
-
],
|
| 959 |
-
inputs=[
|
| 960 |
-
first_image, last_image, input_audio, prompt, duration, gpu_duration,
|
| 961 |
-
enhance_prompt, seed, randomize_seed, height, width,
|
| 962 |
-
pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength, physics_strength, reasoning_strength, twostep_strength,
|
| 963 |
-
],
|
| 964 |
-
)
|
| 965 |
-
|
| 966 |
first_image.change(
|
| 967 |
fn=on_image_upload,
|
| 968 |
inputs=[first_image, last_image, high_res],
|
|
@@ -990,7 +883,7 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 990 |
generate_btn.click(
|
| 991 |
fn=generate_video,
|
| 992 |
inputs=[
|
| 993 |
-
first_image, last_image,
|
| 994 |
seed, randomize_seed, height, width,
|
| 995 |
pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength, physics_strength, reasoning_strength, twostep_strength,
|
| 996 |
],
|
|
|
|
| 106 |
}
|
| 107 |
|
| 108 |
|
| 109 |
+
class LTX23DistilledA2VPipeline:
|
| 110 |
+
|
| 111 |
+
def __init__(
|
| 112 |
+
self,
|
| 113 |
+
distilled_checkpoint_path: str,
|
| 114 |
+
spatial_upsampler_path: str,
|
| 115 |
+
gemma_root: str,
|
| 116 |
+
loras: tuple,
|
| 117 |
+
quantization: QuantizationPolicy | None = None,
|
| 118 |
+
):
|
| 119 |
+
from ltx_pipelines.utils import ModelLedger, denoise_audio_video
|
| 120 |
+
from ltx_pipelines.utils.types import PipelineComponents
|
| 121 |
+
|
| 122 |
+
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 123 |
+
self.dtype = torch.bfloat16
|
| 124 |
+
|
| 125 |
+
self.model_ledger = ModelLedger(
|
| 126 |
+
dtype=self.dtype,
|
| 127 |
+
device=self.device,
|
| 128 |
+
checkpoint_path=distilled_checkpoint_path,
|
| 129 |
+
gemma_root_path=gemma_root,
|
| 130 |
+
spatial_upsampler_path=spatial_upsampler_path,
|
| 131 |
+
loras=loras,
|
| 132 |
+
quantization=quantization,
|
| 133 |
+
)
|
| 134 |
+
|
| 135 |
+
self.pipeline_components = PipelineComponents(
|
| 136 |
+
dtype=self.dtype,
|
| 137 |
+
device=self.device,
|
| 138 |
+
)
|
| 139 |
|
| 140 |
def __call__(
|
| 141 |
self,
|
|
|
|
| 146 |
num_frames: int,
|
| 147 |
frame_rate: float,
|
| 148 |
images: list[ImageConditioningInput],
|
|
|
|
| 149 |
tiling_config: TilingConfig | None = None,
|
| 150 |
enhance_prompt: bool = False,
|
| 151 |
):
|
|
|
|
| 152 |
print(prompt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
|
| 154 |
generator = torch.Generator(device=self.device).manual_seed(seed)
|
| 155 |
noiser = GaussianNoiser(generator=generator)
|
|
|
|
| 165 |
video_context, audio_context = ctx_p.video_encoding, ctx_p.audio_encoding
|
| 166 |
|
| 167 |
video_duration = num_frames / frame_rate
|
|
|
|
|
|
|
|
|
|
| 168 |
|
| 169 |
encoded_audio_latent = vae_encode_audio(decoded_audio, self.model_ledger.audio_encoder())
|
| 170 |
audio_shape = AudioLatentShape.from_duration(batch=1, duration=video_duration, channels=8, mel_bins=16)
|
|
|
|
| 273 |
tiling_config,
|
| 274 |
generator,
|
| 275 |
)
|
| 276 |
+
decoded_audio_output = vae_decode_audio(
|
| 277 |
+
audio_state.latent,
|
| 278 |
+
self.model_ledger.audio_decoder(),
|
| 279 |
+
self.model_ledger.vocoder(),
|
| 280 |
)
|
| 281 |
+
return decoded_video, decoded_audio_output
|
| 282 |
|
| 283 |
|
| 284 |
# Model repos
|
| 285 |
LTX_MODEL_REPO = "Lightricks/LTX-2.3"
|
| 286 |
GEMMA_REPO ="Lightricks/gemma-3-12b-it-qat-q4_0-unquantized"
|
|
|
|
|
|
|
| 287 |
|
| 288 |
# Download model checkpoints
|
| 289 |
print("=" * 80)
|
|
|
|
| 307 |
local_dir=str(weights_dir),
|
| 308 |
local_dir_use_symlinks=False,
|
| 309 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
spatial_upsampler_path = hf_hub_download(repo_id=LTX_MODEL_REPO, filename="ltx-2.3-spatial-upscaler-x2-1.1.safetensors")
|
| 311 |
gemma_root = snapshot_download(repo_id=GEMMA_REPO)
|
| 312 |
|
|
|
|
| 324 |
dreamlay_lora_path = hf_hub_download(repo_id="lynaNSFW/DR34ML4Y_AIO_NSFW_LTX23", filename="DR34ML4Y_LTXXX_V2.safetensors") # m15510n4ry, bl0wj0b, d0ubl3_bj, d0gg1e, c0wg1rl
|
| 325 |
mself_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="Furry Hyper Masturbation - LTX-2 I2V v1.safetensors") # Hyperfap
|
| 326 |
dramatic_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX-2.3 - Orgasm.safetensors") # "[He | She] is having am orgasm." (am or an?)
|
| 327 |
+
fluid_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="Cr3ampi3_animation_sulphur-2_i2v_v1.0.safetensors") # cr3ampi3 animation
|
| 328 |
liquid_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="liquid_wet_dr1pp_ltx2_v1.0_scaled.safetensors") # wet dr1pp
|
| 329 |
demopose_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="clapping-cheeks-audio-v001-alpha.safetensors")
|
| 330 |
voice_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="hentai_voice_ltx23.safetensors")
|
|
|
|
| 540 |
# Save the original factory methods so we can rebuild individual components later.
|
| 541 |
# These are bound callables on ledger that will call the builder when invoked.
|
| 542 |
_orig_transformer_factory = ledger.transformer
|
| 543 |
+
_orig_video_encoder_factory = ledger.video_encode
|
| 544 |
_orig_video_decoder_factory = ledger.video_decoder
|
|
|
|
| 545 |
_orig_audio_decoder_factory = ledger.audio_decoder
|
| 546 |
_orig_vocoder_factory = ledger.vocoder
|
| 547 |
_orig_spatial_upsampler_factory = ledger.spatial_upsampler
|
|
|
|
| 552 |
_transformer = _orig_transformer_factory()
|
| 553 |
_video_encoder = _orig_video_encoder_factory()
|
| 554 |
_video_decoder = _orig_video_decoder_factory()
|
|
|
|
| 555 |
_audio_decoder = _orig_audio_decoder_factory()
|
| 556 |
_vocoder = _orig_vocoder_factory()
|
| 557 |
_spatial_upsampler = _orig_spatial_upsampler_factory()
|
|
|
|
| 563 |
ledger.transformer = lambda: _transformer
|
| 564 |
ledger.video_encoder = lambda: _video_encoder
|
| 565 |
ledger.video_decoder = lambda: _video_decoder
|
|
|
|
| 566 |
ledger.audio_decoder = lambda: _audio_decoder
|
| 567 |
ledger.vocoder = lambda: _vocoder
|
| 568 |
ledger.spatial_upsampler = lambda: _spatial_upsampler
|
|
|
|
| 618 |
def get_gpu_duration(
|
| 619 |
first_image,
|
| 620 |
last_image,
|
|
|
|
| 621 |
prompt: str,
|
| 622 |
duration: float = 0.0,
|
| 623 |
gpu_duration: float = 0.0,
|
|
|
|
| 650 |
def generate_video(
|
| 651 |
first_image,
|
| 652 |
last_image,
|
|
|
|
| 653 |
prompt: str,
|
| 654 |
duration: float = 0.0,
|
| 655 |
gpu_duration: float = 0.0,
|
|
|
|
| 722 |
num_frames=num_frames,
|
| 723 |
frame_rate=frame_rate,
|
| 724 |
images=images,
|
|
|
|
| 725 |
tiling_config=tiling_config,
|
| 726 |
enhance_prompt=enhance_prompt,
|
| 727 |
)
|
|
|
|
| 756 |
with gr.Row():
|
| 757 |
first_image = gr.Image(label="First Frame (Optional)", type="pil")
|
| 758 |
last_image = gr.Image(label="Last Frame (Optional)", type="pil")
|
|
|
|
| 759 |
prompt = gr.Textbox(
|
| 760 |
label="Prompt",
|
| 761 |
info="for best results - make it as elaborate as possible",
|
|
|
|
| 856 |
step=1.0,
|
| 857 |
)
|
| 858 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 859 |
first_image.change(
|
| 860 |
fn=on_image_upload,
|
| 861 |
inputs=[first_image, last_image, high_res],
|
|
|
|
| 883 |
generate_btn.click(
|
| 884 |
fn=generate_video,
|
| 885 |
inputs=[
|
| 886 |
+
first_image, last_image, prompt, duration, gpu_duration, enhance_prompt,
|
| 887 |
seed, randomize_seed, height, width,
|
| 888 |
pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength, physics_strength, reasoning_strength, twostep_strength,
|
| 889 |
],
|