Update app.py
Browse files
app.py
CHANGED
|
@@ -313,6 +313,8 @@ demopose_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="clapping-cheek
|
|
| 313 |
voice_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="hentai_voice_ltx23.safetensors")
|
| 314 |
realism_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="FurryenhancerLTX2.3V1.215.safetensors")
|
| 315 |
transition_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX-2_takerpov_lora_v1.2.safetensors") # takerpov1, taker pov
|
|
|
|
|
|
|
| 316 |
|
| 317 |
print(f"Pose LoRA: {pose_lora_path}")
|
| 318 |
print(f"General LoRA: {general_lora_path}")
|
|
@@ -326,6 +328,8 @@ print(f"Demopose LoRA: {demopose_lora_path}")
|
|
| 326 |
print(f"Voice LoRA: {voice_lora_path}")
|
| 327 |
print(f"Realism LoRA: {realism_lora_path}")
|
| 328 |
print(f"Transition LoRA: {transition_lora_path}")
|
|
|
|
|
|
|
| 329 |
# ----------------------------------------------------------------
|
| 330 |
|
| 331 |
print(f"Checkpoint: {checkpoint_path}")
|
|
@@ -343,7 +347,7 @@ pipeline = LTX23DistilledA2VPipeline(
|
|
| 343 |
)
|
| 344 |
# ----------------------------------------------------------------
|
| 345 |
|
| 346 |
-
def _make_lora_key(pose_strength: float, general_strength: float, motion_strength: float, dreamlay_strength: float, mself_strength: float, dramatic_strength: float, fluid_strength: float, liquid_strength: float, demopose_strength: float, voice_strength: float, realism_strength: float, transition_strength: float) -> tuple[str, str]:
|
| 347 |
rp = round(float(pose_strength), 2)
|
| 348 |
rg = round(float(general_strength), 2)
|
| 349 |
rm = round(float(motion_strength), 2)
|
|
@@ -356,7 +360,9 @@ def _make_lora_key(pose_strength: float, general_strength: float, motion_strengt
|
|
| 356 |
rv = round(float(voice_strength), 2)
|
| 357 |
re = round(float(realism_strength), 2)
|
| 358 |
rt = round(float(transition_strength), 2)
|
| 359 |
-
|
|
|
|
|
|
|
| 360 |
key = hashlib.sha256(key_str.encode("utf-8")).hexdigest()
|
| 361 |
return key, key_str
|
| 362 |
|
|
@@ -374,6 +380,8 @@ def prepare_lora_cache(
|
|
| 374 |
voice_strength: float,
|
| 375 |
realism_strength: float,
|
| 376 |
transition_strength: float,
|
|
|
|
|
|
|
| 377 |
progress=gr.Progress(track_tqdm=True),
|
| 378 |
):
|
| 379 |
"""
|
|
@@ -386,7 +394,7 @@ def prepare_lora_cache(
|
|
| 386 |
global PENDING_LORA_KEY, PENDING_LORA_STATE, PENDING_LORA_STATUS
|
| 387 |
|
| 388 |
ledger = pipeline.model_ledger
|
| 389 |
-
key, _ = _make_lora_key(pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength)
|
| 390 |
cache_path = LORA_CACHE_DIR / f"{key}.safetensors"
|
| 391 |
|
| 392 |
progress(0.05, desc="Preparing LoRA state")
|
|
@@ -414,6 +422,8 @@ def prepare_lora_cache(
|
|
| 414 |
(voice_lora_path, round(float(voice_strength), 2)),
|
| 415 |
(realism_lora_path, round(float(realism_strength), 2)),
|
| 416 |
(transition_lora_path, round(float(transition_strength), 2)),
|
|
|
|
|
|
|
| 417 |
]
|
| 418 |
loras_for_builder = [
|
| 419 |
LoraPathStrengthAndSDOps(path, strength, LTXV_LORA_COMFY_RENAMING_MAP)
|
|
@@ -610,6 +620,8 @@ def get_gpu_duration(
|
|
| 610 |
voice_strength: float = 0.0,
|
| 611 |
realism_strength: float = 0.0,
|
| 612 |
transition_strength: float = 0.0,
|
|
|
|
|
|
|
| 613 |
progress=None,
|
| 614 |
):
|
| 615 |
return int(gpu_duration)
|
|
@@ -640,6 +652,8 @@ def generate_video(
|
|
| 640 |
voice_strength: float = 0.0,
|
| 641 |
realism_strength: float = 0.0,
|
| 642 |
transition_strength: float = 0.0,
|
|
|
|
|
|
|
| 643 |
progress=gr.Progress(track_tqdm=True),
|
| 644 |
):
|
| 645 |
try:
|
|
@@ -796,6 +810,14 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 796 |
label="POV strength",
|
| 797 |
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 798 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 799 |
prepare_lora_btn = gr.Button("Prepare / Load LoRA Cache", variant="secondary")
|
| 800 |
lora_status = gr.Textbox(
|
| 801 |
label="LoRA Cache Status",
|
|
@@ -844,12 +866,14 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 844 |
0.0,
|
| 845 |
0.0,
|
| 846 |
0.0,
|
|
|
|
|
|
|
| 847 |
],
|
| 848 |
],
|
| 849 |
inputs=[
|
| 850 |
first_image, last_image, input_audio, prompt, duration, gpu_duration,
|
| 851 |
enhance_prompt, seed, randomize_seed, height, width,
|
| 852 |
-
pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength,
|
| 853 |
],
|
| 854 |
)
|
| 855 |
|
|
@@ -873,7 +897,7 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 873 |
|
| 874 |
prepare_lora_btn.click(
|
| 875 |
fn=prepare_lora_cache,
|
| 876 |
-
inputs=[pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength],
|
| 877 |
outputs=[lora_status],
|
| 878 |
)
|
| 879 |
|
|
@@ -882,7 +906,7 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 882 |
inputs=[
|
| 883 |
first_image, last_image, input_audio, prompt, duration, gpu_duration, enhance_prompt,
|
| 884 |
seed, randomize_seed, height, width,
|
| 885 |
-
pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength,
|
| 886 |
],
|
| 887 |
outputs=[output_video, seed],
|
| 888 |
)
|
|
|
|
| 313 |
voice_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="hentai_voice_ltx23.safetensors")
|
| 314 |
realism_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="FurryenhancerLTX2.3V1.215.safetensors")
|
| 315 |
transition_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX-2_takerpov_lora_v1.2.safetensors") # takerpov1, taker pov
|
| 316 |
+
physics_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_Better_Physics_PhysLTX.safetensors")
|
| 317 |
+
reasoning_lora_path = hf_hub_download(repo_id="LiconStudio/Ltx2.3-VBVR-lora-I2V", filename="Ltx2.3-Licon-VBVR-I2V-390K-R32.safetensors")
|
| 318 |
|
| 319 |
print(f"Pose LoRA: {pose_lora_path}")
|
| 320 |
print(f"General LoRA: {general_lora_path}")
|
|
|
|
| 328 |
print(f"Voice LoRA: {voice_lora_path}")
|
| 329 |
print(f"Realism LoRA: {realism_lora_path}")
|
| 330 |
print(f"Transition LoRA: {transition_lora_path}")
|
| 331 |
+
print(f"Physics LoRA: {physics_lora_path}")
|
| 332 |
+
print(f"Reasoning LoRA: {reasoning_lora_path}")
|
| 333 |
# ----------------------------------------------------------------
|
| 334 |
|
| 335 |
print(f"Checkpoint: {checkpoint_path}")
|
|
|
|
| 347 |
)
|
| 348 |
# ----------------------------------------------------------------
|
| 349 |
|
| 350 |
+
def _make_lora_key(pose_strength: float, general_strength: float, motion_strength: float, dreamlay_strength: float, mself_strength: float, dramatic_strength: float, fluid_strength: float, liquid_strength: float, demopose_strength: float, voice_strength: float, realism_strength: float, transition_strength: float, physics_strength: float, reasoning_strength: float) -> tuple[str, str]:
|
| 351 |
rp = round(float(pose_strength), 2)
|
| 352 |
rg = round(float(general_strength), 2)
|
| 353 |
rm = round(float(motion_strength), 2)
|
|
|
|
| 360 |
rv = round(float(voice_strength), 2)
|
| 361 |
re = round(float(realism_strength), 2)
|
| 362 |
rt = round(float(transition_strength), 2)
|
| 363 |
+
ry = round(float(physics_strength), 2)
|
| 364 |
+
ri = round(float(reasoning_strength), 2)
|
| 365 |
+
key_str = f"{pose_lora_path}:{rp}|{general_lora_path}:{rg}|{motion_lora_path}:{rm}|{dreamlay_lora_path}:{rd}|{mself_lora_path}:{rs}|{dramatic_lora_path}:{rr}|{fluid_lora_path}:{rf}|{liquid_lora_path}:{rl}|{demopose_lora_path}:{ro}|{voice_lora_path}:{rv}|{realism_lora_path}:{re}|{transition_lora_path}:{rt}|{physics_lora_path}:{ry}|{reasoning_lora_path}:{ri}"
|
| 366 |
key = hashlib.sha256(key_str.encode("utf-8")).hexdigest()
|
| 367 |
return key, key_str
|
| 368 |
|
|
|
|
| 380 |
voice_strength: float,
|
| 381 |
realism_strength: float,
|
| 382 |
transition_strength: float,
|
| 383 |
+
physics_strength: float,
|
| 384 |
+
reasoning_strength: float,
|
| 385 |
progress=gr.Progress(track_tqdm=True),
|
| 386 |
):
|
| 387 |
"""
|
|
|
|
| 394 |
global PENDING_LORA_KEY, PENDING_LORA_STATE, PENDING_LORA_STATUS
|
| 395 |
|
| 396 |
ledger = pipeline.model_ledger
|
| 397 |
+
key, _ = _make_lora_key(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)
|
| 398 |
cache_path = LORA_CACHE_DIR / f"{key}.safetensors"
|
| 399 |
|
| 400 |
progress(0.05, desc="Preparing LoRA state")
|
|
|
|
| 422 |
(voice_lora_path, round(float(voice_strength), 2)),
|
| 423 |
(realism_lora_path, round(float(realism_strength), 2)),
|
| 424 |
(transition_lora_path, round(float(transition_strength), 2)),
|
| 425 |
+
(physics_lora_path, round(float(physics_strength), 2)),
|
| 426 |
+
(reasoning_lora_path, round(float(reasoning_strength), 2)),
|
| 427 |
]
|
| 428 |
loras_for_builder = [
|
| 429 |
LoraPathStrengthAndSDOps(path, strength, LTXV_LORA_COMFY_RENAMING_MAP)
|
|
|
|
| 620 |
voice_strength: float = 0.0,
|
| 621 |
realism_strength: float = 0.0,
|
| 622 |
transition_strength: float = 0.0,
|
| 623 |
+
physics_strength: float = 0.0,
|
| 624 |
+
reasoning_strength: float = 0.0,
|
| 625 |
progress=None,
|
| 626 |
):
|
| 627 |
return int(gpu_duration)
|
|
|
|
| 652 |
voice_strength: float = 0.0,
|
| 653 |
realism_strength: float = 0.0,
|
| 654 |
transition_strength: float = 0.0,
|
| 655 |
+
physics_strength: float = 0.0,
|
| 656 |
+
reasoning_strength: float = 0.0,
|
| 657 |
progress=gr.Progress(track_tqdm=True),
|
| 658 |
):
|
| 659 |
try:
|
|
|
|
| 810 |
label="POV strength",
|
| 811 |
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 812 |
)
|
| 813 |
+
physics_strength = gr.Slider(
|
| 814 |
+
label="Physics strength",
|
| 815 |
+
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 816 |
+
)
|
| 817 |
+
reasoning_strength = gr.Slider(
|
| 818 |
+
label="Alternative Reasoning strength",
|
| 819 |
+
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 820 |
+
)
|
| 821 |
prepare_lora_btn = gr.Button("Prepare / Load LoRA Cache", variant="secondary")
|
| 822 |
lora_status = gr.Textbox(
|
| 823 |
label="LoRA Cache Status",
|
|
|
|
| 866 |
0.0,
|
| 867 |
0.0,
|
| 868 |
0.0,
|
| 869 |
+
0.0,
|
| 870 |
+
0.0,
|
| 871 |
],
|
| 872 |
],
|
| 873 |
inputs=[
|
| 874 |
first_image, last_image, input_audio, prompt, duration, gpu_duration,
|
| 875 |
enhance_prompt, seed, randomize_seed, height, width,
|
| 876 |
+
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,
|
| 877 |
],
|
| 878 |
)
|
| 879 |
|
|
|
|
| 897 |
|
| 898 |
prepare_lora_btn.click(
|
| 899 |
fn=prepare_lora_cache,
|
| 900 |
+
inputs=[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],
|
| 901 |
outputs=[lora_status],
|
| 902 |
)
|
| 903 |
|
|
|
|
| 906 |
inputs=[
|
| 907 |
first_image, last_image, input_audio, prompt, duration, gpu_duration, enhance_prompt,
|
| 908 |
seed, randomize_seed, height, width,
|
| 909 |
+
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,
|
| 910 |
],
|
| 911 |
outputs=[output_video, seed],
|
| 912 |
)
|