Spaces:
Running on Zero
Running on Zero
Show CPU LoRA results immediately
Browse files
app.py
CHANGED
|
@@ -10107,13 +10107,14 @@ with gr.Blocks(title="Wan 2.2 Studio | NEW AI Scene Planner · 64 Clips · 3 Aud
|
|
| 10107 |
|
| 10108 |
_ACTIVE_LORA_FIELDS = ui_inputs[16:53]
|
| 10109 |
_ACTIVE_LORA_INPUTS = [lora_catalog_state, basic_shortlist, *_ACTIVE_LORA_FIELDS]
|
|
|
|
| 10110 |
|
| 10111 |
def _show_active_loras(library, state, *adapter_values):
|
| 10112 |
summary = _wan_active_lora_summary(library, state, *adapter_values)
|
| 10113 |
return summary, summary, summary
|
| 10114 |
|
| 10115 |
gr.on([component.change for component in _ACTIVE_LORA_INPUTS], _show_active_loras,
|
| 10116 |
-
_ACTIVE_LORA_INPUTS,
|
| 10117 |
queue=False, show_progress="hidden", trigger_mode="always_last", api_name=False)
|
| 10118 |
|
| 10119 |
_CPU_LORA_FIELDS = _ACTIVE_LORA_FIELDS[3:]
|
|
@@ -10131,7 +10132,8 @@ with gr.Blocks(title="Wan 2.2 Studio | NEW AI Scene Planner · 64 Clips · 3 Aud
|
|
| 10131 |
if not choices:
|
| 10132 |
note = ("Write or paste a prompt first." if not prompt_basis.strip()
|
| 10133 |
else "No compatible match could be added. Current LoRAs were kept.")
|
| 10134 |
-
|
|
|
|
| 10135 |
|
| 10136 |
def put(index, value, options=None):
|
| 10137 |
values[index] = value
|
|
@@ -10164,7 +10166,8 @@ with gr.Blocks(title="Wan 2.2 Studio | NEW AI Scene Planner · 64 Clips · 3 Aud
|
|
| 10164 |
library=library, resolve_missing=False)
|
| 10165 |
built = [name for name in presets if name and name != "(None)"]
|
| 10166 |
note = f"Added {len(choices)} LoRA{'s' if len(choices) != 1 else ''} from your prompt."
|
| 10167 |
-
|
|
|
|
| 10168 |
|
| 10169 |
for _button, _prompt, _status, _scene, _api in (
|
| 10170 |
(cpu_lora, prompt_input, cpu_lora_status, False, "pick_loras_cpu"),
|
|
@@ -10175,7 +10178,7 @@ with gr.Blocks(title="Wan 2.2 Studio | NEW AI Scene Planner · 64 Clips · 3 Aud
|
|
| 10175 |
functools.partial(_apply_cpu_loras, scene=_scene),
|
| 10176 |
[_prompt, scene_prompts, scene_idea, lora_catalog_state, basic_shortlist,
|
| 10177 |
simple_lora_strength, identity_strength_slider, *_ACTIVE_LORA_FIELDS],
|
| 10178 |
-
[_status, simple_lora, *_CPU_LORA_FIELDS, *_TRIGGER_OUTPUTS],
|
| 10179 |
show_progress="minimal", concurrency_id="lora-picker", concurrency_limit=1, api_name=_api,
|
| 10180 |
)
|
| 10181 |
_cpu_picked.success(_gpu_estimate_text, _ESTIMATE_INPUTS, gpu_estimate,
|
|
|
|
| 10107 |
|
| 10108 |
_ACTIVE_LORA_FIELDS = ui_inputs[16:53]
|
| 10109 |
_ACTIVE_LORA_INPUTS = [lora_catalog_state, basic_shortlist, *_ACTIVE_LORA_FIELDS]
|
| 10110 |
+
_ACTIVE_LORA_OUTPUTS = [active_loras, extension_active_loras, scene_active_loras]
|
| 10111 |
|
| 10112 |
def _show_active_loras(library, state, *adapter_values):
|
| 10113 |
summary = _wan_active_lora_summary(library, state, *adapter_values)
|
| 10114 |
return summary, summary, summary
|
| 10115 |
|
| 10116 |
gr.on([component.change for component in _ACTIVE_LORA_INPUTS], _show_active_loras,
|
| 10117 |
+
_ACTIVE_LORA_INPUTS, _ACTIVE_LORA_OUTPUTS,
|
| 10118 |
queue=False, show_progress="hidden", trigger_mode="always_last", api_name=False)
|
| 10119 |
|
| 10120 |
_CPU_LORA_FIELDS = _ACTIVE_LORA_FIELDS[3:]
|
|
|
|
| 10132 |
if not choices:
|
| 10133 |
note = ("Write or paste a prompt first." if not prompt_basis.strip()
|
| 10134 |
else "No compatible match could be added. Current LoRAs were kept.")
|
| 10135 |
+
summary = _show_active_loras(library, state, *values)
|
| 10136 |
+
return [note, gr.update(), *updates[3:], *(gr.update() for _ in _TRIGGER_OUTPUTS), *summary]
|
| 10137 |
|
| 10138 |
def put(index, value, options=None):
|
| 10139 |
values[index] = value
|
|
|
|
| 10166 |
library=library, resolve_missing=False)
|
| 10167 |
built = [name for name in presets if name and name != "(None)"]
|
| 10168 |
note = f"Added {len(choices)} LoRA{'s' if len(choices) != 1 else ''} from your prompt."
|
| 10169 |
+
summary = _show_active_loras(library, state, *values)
|
| 10170 |
+
return [note, gr.update(value=built), *updates[3:], *trigger_updates, *summary]
|
| 10171 |
|
| 10172 |
for _button, _prompt, _status, _scene, _api in (
|
| 10173 |
(cpu_lora, prompt_input, cpu_lora_status, False, "pick_loras_cpu"),
|
|
|
|
| 10178 |
functools.partial(_apply_cpu_loras, scene=_scene),
|
| 10179 |
[_prompt, scene_prompts, scene_idea, lora_catalog_state, basic_shortlist,
|
| 10180 |
simple_lora_strength, identity_strength_slider, *_ACTIVE_LORA_FIELDS],
|
| 10181 |
+
[_status, simple_lora, *_CPU_LORA_FIELDS, *_TRIGGER_OUTPUTS, *_ACTIVE_LORA_OUTPUTS],
|
| 10182 |
show_progress="minimal", concurrency_id="lora-picker", concurrency_limit=1, api_name=_api,
|
| 10183 |
)
|
| 10184 |
_cpu_picked.success(_gpu_estimate_text, _ESTIMATE_INPUTS, gpu_estimate,
|