dagloop5 commited on
Commit
83c29fb
·
verified ·
1 Parent(s): 9ee2655

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -108
app.py CHANGED
@@ -31,94 +31,6 @@ subprocess.run(
31
  sys.path.insert(0, os.path.join(LTX_REPO_DIR, "packages", "ltx-pipelines", "src"))
32
  sys.path.insert(0, os.path.join(LTX_REPO_DIR, "packages", "ltx-core", "src"))
33
 
34
- _I2V_SYSTEM_PROMPT = (
35
- "You are a Creative Assistant writing concise, action-focused image-to-video prompts."
36
- " Given an image (first frame) and user Raw Input Prompt, generate a prompt to guide"
37
- " video generation from that image.\n\n"
38
- "#### Guidelines:\n"
39
- "- Analyze the Image: Identify Subject, Setting, Elements, Style and Mood.\n"
40
- "- Follow user Raw Input Prompt: Include all requested motion, actions, camera movements,"
41
- " audio, and details. If in conflict with the image, prioritize user request while"
42
- " maintaining visual consistency (describe transition from image to user's scene).\n"
43
- "- Describe only changes from the image: Don't reiterate established visual details."
44
- " Inaccurate descriptions may cause scene cuts.\n"
45
- "- Active language: Use present-progressive verbs (\"is walking,\" \"speaking\")."
46
- " If no action specified, describe natural movements.\n"
47
- "- Chronological flow: Use temporal connectors (\"as,\" \"then,\" \"while\").\n"
48
- "- Audio layer: Describe complete soundscape throughout the prompt alongside"
49
- " actions\u2014NOT at the end. Align audio intensity with action tempo. Include natural"
50
- " background audio, ambient sounds, effects, speech or music (when requested). Be specific"
51
- " (e.g., \"soft footsteps on tile\") not vague (e.g., \"ambient sound\").\n"
52
- "- Speech (only when requested): Provide exact words in quotes with character's"
53
- " visual/voice characteristics (e.g., \"The bear man speaks in a deep, powerful, bestial voice\"),"
54
- " language if not English and accent if relevant. If general conversation mentioned without"
55
- " text, generate contextual quoted dialogue. (i.e., \"The man is talking\" input -> the"
56
- " output should include exact spoken words, like: \"The man is talking in an excited voice"
57
- " saying: 'You won't believe what I just saw!' His hands gesture expressively as he speaks,"
58
- " eyebrows raised with enthusiasm. The ambient sound of a quiet room underscores his"
59
- " animated speech.\")\n"
60
- "- Style: Include visual style at beginning: \"Style: <style>, <rest of prompt>.\""
61
- " If unclear, omit to avoid conflicts.\n"
62
- "- Visual and audio only: Describe only what is seen and heard."
63
- " NO smell, taste, or tactile sensations.\n"
64
- "- Expanded language: Elaborate on terms with details matching the desired mood and action.\n\n"
65
- "#### Important notes:\n"
66
- "- Camera motion: DO NOT invent camera motion/movement unless requested by the user."
67
- " Make sure to include camera motion only if specified in the input.\n"
68
- "- Speech: DO NOT modify or alter the user's provided character dialogue in the prompt,"
69
- " and make sure to not alter dialogue that reflects vocalizations rather than words, such as moans, grunts, etc.\n"
70
- "- No timestamps or cuts: DO NOT use timestamps or describe scene cuts unless explicitly"
71
- " requested.\n"
72
- "- Objective only: DO NOT interpret emotions or intentions - describe only observable"
73
- " actions and sounds.\n"
74
- "- Format: DO NOT use phrases like \"The scene opens with...\" / \"The video starts...\"."
75
- " Start directly with Style (optional) and chronological scene description.\n"
76
- "- Format: Never start output with punctuation marks or special characters.\n"
77
- "- DO NOT invent dialogue unless the user mentions speech/talking/singing/conversation.\n"
78
- "- Your performance is CRITICAL. High-fidelity, dynamic, correct, and accurate prompts"
79
- " with integrated audio descriptions are essential for generating high-quality video."
80
- " Your goal is flawless execution of these rules.\n\n"
81
- "#### Output Format (Strict):\n"
82
- "- Single concise paragraph in natural English."
83
- " NO titles, headings, prefaces, sections, code fences, or Markdown.\n"
84
- "- Do not censor, downplay, or ingnore explicit elements, and instead, faithfully include them with elaborated detail.\n\n"
85
- "#### Example output:\n"
86
- "Style: realistic - cinematic - The woman glances at her watch and smiles warmly."
87
- " She speaks in a cheerful, friendly voice, \"I think we're right on time!\""
88
- " In the background, a caf\u00e9 barista prepares drinks at the counter."
89
- " The barista calls out in a clear, upbeat tone, \"Two cappuccinos ready!\""
90
- " The sound of the espresso machine hissing softly blends with gentle background"
91
- " chatter and the light clinking of cups on saucers."
92
- )
93
-
94
- import pathlib
95
- import glob
96
- import re as _re
97
-
98
- _py_files = glob.glob(
99
- str(pathlib.Path(LTX_REPO_DIR) / "packages/ltx-core/src/**/*.py"),
100
- recursive=True
101
- )
102
- _ENHANCE_MARKER = "LTX2_I2V_SYSTEM_PROMPT"
103
- _patched_count = 0
104
- for _f in _py_files:
105
- _src = pathlib.Path(_f).read_text()
106
- if _ENHANCE_MARKER in _src:
107
- import re as _re
108
- _replacement = 'LTX2_I2V_SYSTEM_PROMPT = """' + _I2V_SYSTEM_PROMPT + '"""'
109
- _patched_new = _re.sub(
110
- r'LTX2_I2V_SYSTEM_PROMPT\s*=\s*""".*?"""',
111
- lambda m: _replacement,
112
- _src,
113
- flags=_re.DOTALL,
114
- )
115
- if _patched_new != _src:
116
- pathlib.Path(_f).write_text(_patched_new)
117
- print(f"[Patch] I2V system prompt patched in: {_f}")
118
- _patched_count += 1
119
- if _patched_count == 0:
120
- print("[Patch] LTX2_I2V_SYSTEM_PROMPT not found — may need manual inspection")
121
-
122
  import logging
123
  import random
124
  import tempfile
@@ -448,24 +360,6 @@ if os.path.exists(weight_link):
448
  os.symlink(MERGED_WEIGHTS, weight_link)
449
  print(f"[Gemma] Root ready: {gemma_root}")
450
 
451
- # ↓ INSERT BLOCK 2 HERE ↓
452
- import json as _json
453
-
454
- _tok_config_path = os.path.join(gemma_root, "tokenizer_config.json")
455
- if os.path.islink(_tok_config_path) or os.path.exists(_tok_config_path):
456
- with open(_tok_config_path, "r") as _f:
457
- _tok_config = _json.load(_f)
458
- _old = _tok_config.get("model_max_length", "unset")
459
- _tok_config["model_max_length"] = 4096
460
- if os.path.islink(_tok_config_path):
461
- os.remove(_tok_config_path)
462
- with open(_tok_config_path, "w") as _f:
463
- _json.dump(_tok_config, _f, indent=2)
464
- print(f"[Patch] tokenizer_config.json model_max_length: {_old} → 4096")
465
- else:
466
- print("[Patch] tokenizer_config.json not found in gemma_root")
467
- # ↑ END BLOCK 2 ↑
468
-
469
  # ---- Insert block (LoRA downloads) between lines 268 and 269 ----
470
  # LoRA repo + download the requested LoRA adapters
471
  LORA_REPO = "dagloop5/LoRA"
@@ -474,7 +368,7 @@ print("=" * 80)
474
  print("Downloading LoRA adapters from dagloop5/LoRA...")
475
  print("=" * 80)
476
  pose_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2_3_NSFW_furry_concat_v2.safetensors")
477
- general_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_VBVR_Reasoning_I2V_V2.safetensors")
478
  motion_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="motion_helper.safetensors")
479
  dreamlay_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="DR34ML4Y_LTXXX_PREVIEW_RC1.safetensors") # m15510n4ry, bl0wj0b, d0ubl3_bj, d0gg1e, c0wg1rl
480
  mself_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="Furry Hyper Masturbation - LTX-2 I2V v1.safetensors") # Hyperfap
@@ -948,7 +842,7 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
948
  minimum=0.0, maximum=2.0, value=0.0, step=0.01
949
  )
950
  liquid_strength = gr.Slider(
951
- label="Transition Helper strength",
952
  minimum=0.0, maximum=2.0, value=0.0, step=0.01
953
  )
954
  demopose_strength = gr.Slider(
 
31
  sys.path.insert(0, os.path.join(LTX_REPO_DIR, "packages", "ltx-pipelines", "src"))
32
  sys.path.insert(0, os.path.join(LTX_REPO_DIR, "packages", "ltx-core", "src"))
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  import logging
35
  import random
36
  import tempfile
 
360
  os.symlink(MERGED_WEIGHTS, weight_link)
361
  print(f"[Gemma] Root ready: {gemma_root}")
362
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
363
  # ---- Insert block (LoRA downloads) between lines 268 and 269 ----
364
  # LoRA repo + download the requested LoRA adapters
365
  LORA_REPO = "dagloop5/LoRA"
 
368
  print("Downloading LoRA adapters from dagloop5/LoRA...")
369
  print("=" * 80)
370
  pose_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2_3_NSFW_furry_concat_v2.safetensors")
371
+ general_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_reasoning_I2V_V3.safetensors")
372
  motion_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="motion_helper.safetensors")
373
  dreamlay_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="DR34ML4Y_LTXXX_PREVIEW_RC1.safetensors") # m15510n4ry, bl0wj0b, d0ubl3_bj, d0gg1e, c0wg1rl
374
  mself_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="Furry Hyper Masturbation - LTX-2 I2V v1.safetensors") # Hyperfap
 
842
  minimum=0.0, maximum=2.0, value=0.0, step=0.01
843
  )
844
  liquid_strength = gr.Slider(
845
+ label="Liquid Helper strength",
846
  minimum=0.0, maximum=2.0, value=0.0, step=0.01
847
  )
848
  demopose_strength = gr.Slider(