Spaces:
Paused
Paused
Update app.py
Browse files312 unmodified lines3133143153163173187 unmodified lines32632732832933033111 unmodified lines3433443453463473483496 unmodified lines35635735835936036136211 unmodified lines3743753763773783796 unmodified lines38638738838939039139221 unmodified lines414415416417418419190 unmodified lines61061161261361461524 unmodified lines640641642643644645150 unmodified lines79679779879980080142 unmodified lines84484584684784884985085185285385485517 unmodified lines8738748758768778788792 unmodified lines882883884885886887888312 unmodified linesvoice_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="hentai_voice_ltx23.safetensors")realism_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="FurryenhancerLTX2.3V1.215.safetensors")transition_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX-2_takerpov_lora_v1.2.safetensors") # takerpov1, taker povprint(f"Pose LoRA: {pose_lora_path}")print(f"General LoRA: {general_lora_path}")7 unmodified linesprint(f"Voice LoRA: {voice_lora_path}")print(f"Realism LoRA: {realism_lora_path}")print(f"Transition LoRA: {transition_lora_path}")# ----------------------------------------------------------------print(f"Checkpoint: {checkpoint_path}")11 unmodified lines)# ----------------------------------------------------------------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]:rp = round(float(pose_strength), 2)rg = round(float(general_strength), 2)rm = round(float(motion_strength), 2)6 unmodified linesrv = round(float(voice_strength), 2)re = round(float(realism_strength), 2)rt = round(float(transition_strength), 2)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}"key = hashlib.sha256(key_str.encode("utf-8")).hexdigest()return key, key_str11 unmodified linesvoice_strength: float,realism_strength: float,transition_strength: float,progress=gr.Progress(track_tqdm=True),):"""6 unmodified linesglobal PENDING_LORA_KEY, PENDING_LORA_STATE, PENDING_LORA_STATUSledger = pipeline.model_ledgerkey, _ = _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)cache_path = LORA_CACHE_DIR / f"{key}.safetensors"progress(0.05, desc="Preparing LoRA state")21 unmodified lines(voice_lora_path, round(float(voice_strength), 2)),(realism_lora_path, round(float(realism_strength), 2)),(transition_lora_path, round(float(transition_strength), 2)),]loras_for_builder = [LoraPathStrengthAndSDOps(path, strength, LTXV_LORA_COMFY_RENAMING_MAP)190 unmodified linesvoice_strength: float = 0.0,realism_strength: float = 0.0,transition_strength: float = 0.0,progress=None,):return int(gpu_duration)24 unmodified linesvoice_strength: float = 0.0,realism_strength: float = 0.0,transition_strength: float = 0.0,progress=gr.Progress(track_tqdm=True),):try:150 unmodified lineslabel="POV strength",minimum=0.0, maximum=2.0, value=0.0, step=0.01)prepare_lora_btn = gr.Button("Prepare / Load LoRA Cache", variant="secondary")lora_status = gr.Textbox(label="LoRA Cache Status",42 unmodified lines0.0,0.0,0.0,],],inputs=[first_image, last_image, input_audio, prompt, duration, gpu_duration,enhance_prompt, seed, randomize_seed, height, width,pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength,],)17 unmodified linesprepare_lora_btn.click(fn=prepare_lora_cache,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],outputs=[lora_status],)2 unmodified linesinputs=[first_image, last_image, input_audio, prompt, duration, gpu_duration, enhance_prompt,seed, randomize_seed, height, width,pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength,],outputs=[output_video, seed],)312 unmodified lines3133143153163173183193207 unmodified lines32832933033133233333433511 unmodified lines3473483493503513523536 unmodified lines36036136236336436536636736811 unmodified lines3803813823833843853863876 unmodified lines39439539639739839940021 unmodified lines422423424425426427428429190 unmodified lines62062162262362462562662724 unmodified lines652653654655656657658659150 unmodified lines81081181281381481581681781881982082182282342 unmodified lines86686786886987087187287387487587687787887917 unmodified lines8978988999009019029032 unmodified lines906907908909910911912312 unmodified linesvoice_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="hentai_voice_ltx23.safetensors")realism_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="FurryenhancerLTX2.3V1.215.safetensors")transition_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX-2_takerpov_lora_v1.2.safetensors") # takerpov1, taker povphysics_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_Better_Physics_PhysLTX.safetensors")reasoning_lora_path = hf_hub_download(repo_id="LiconStudio/Ltx2.3-VBVR-lora-I2V", filename="Ltx2.3-Licon-VBVR-I2V-390K-R32.safetensors")print(f"Pose LoRA: {pose_lora_path}")print(f"General LoRA: {general_lora_path}")7 unmodified linesprint(f"Voice LoRA: {voice_lora_path}")print(f"Realism LoRA: {realism_lora_path}")print(f"Transition LoRA: {transition_lora_path}")print(f"Physics LoRA: {physics_lora_path}")print(f"Reasoning LoRA: {reasoning_lora_path}")# ----------------------------------------------------------------print(f"Checkpoint: {checkpoint_path}")11 unmodified lines)# ----------------------------------------------------------------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]:rp = round(float(pose_strength), 2)rg = round(float(general_strength), 2)rm = round(float(motion_strength), 2)6 unmodified linesrv = round(float(voice_strength), 2)re = round(float(realism_strength), 2)rt = round(float(transition_strength), 2)ry = round(float(physics_strength), 2)ri = round(float(reasoning_strength), 2)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}"key = hashlib.sha256(key_str.encode("utf-8")).hexdigest()return key, key_str11 unmodified linesvoice_strength: float,realism_strength: float,transition_strength: float,physics_strength: float,reasoning_strength: float,progress=gr.Progress(track_tqdm=True),):"""6 unmodified linesglobal PENDING_LORA_KEY, PENDING_LORA_STATE, PENDING_LORA_STATUSledger = pipeline.model_ledgerkey, _ = _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)cache_path = LORA_CACHE_DIR / f"{key}.safetensors"progress(0.05, desc="Preparing LoRA state")21 unmodified lines(voice_lora_path, round(float(voice_strength), 2)),(realism_lora_path, round(float(realism_strength), 2)),(transition_lora_path, round(float(transition_strength), 2)),(physics_lora_path, round(float(physics_strength), 2)),(reasoning_lora_path, round(float(reasoning_strength), 2)),]loras_for_builder = [LoraPathStrengthAndSDOps(path, strength, LTXV_LORA_COMFY_RENAMING_MAP)190 unmodified linesvoice_strength: float = 0.0,realism_strength: float = 0.0,transition_strength: float = 0.0,physics_strength: float = 0.0,reasoning_strength: float = 0.0,progress=None,):return int(gpu_duration)24 unmodified linesvoice_strength: float = 0.0,realism_strength: float = 0.0,transition_strength: float = 0.0,physics_strength: float = 0.0,reasoning_strength: float = 0.0,progress=gr.Progress(track_tqdm=True),):try:150 unmodified lineslabel="POV strength",minimum=0.0, maximum=2.0, value=0.0, step=0.01)physics_strength = gr.Slider(label="Physics strength",minimum=0.0, maximum=2.0, value=0.0, step=0.01)reasoning_strength = gr.Slider(label="Alternative Reasoning strength",minimum=0.0, maximum=2.0, value=0.0, step=0.01)prepare_lora_btn = gr.Button("Prepare / Load LoRA Cache", variant="secondary")lora_status = gr.Textbox(label="LoRA Cache Status",42 unmodified lines0.0,0.0,0.0,0.0,0.0,],],inputs=[first_image, last_image, input_audio, prompt, duration, gpu_duration,enhance_prompt, seed, randomize_seed, height, width,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,],)17 unmodified linesprepare_lora_btn.click(fn=prepare_lora_cache,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],outputs=[lora_status],)2 unmodified linesinputs=[first_image, last_image, input_audio, prompt, duration, gpu_duration, enhance_prompt,seed, randomize_seed, height, width,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,],outputs=[output_video, seed],)
app.py+30-6