Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -575,6 +575,7 @@ def conditioner():
|
|
| 575 |
def encode_remote(
|
| 576 |
prompt, image_path, last_image_path, canvas, num_frames, rewrite_prompt=False,
|
| 577 |
semantic_bridge=False, semantic_bridge_alpha=0.10, semantic_bridge_magnitude_match="per_token",
|
|
|
|
| 578 |
):
|
| 579 |
"""`/encode` on the conditioner Space: a safetensors file holding `prompt_embeds` + `text_token_tags`, with the
|
| 580 |
resolved `height` / `width` / `num_frames` in its metadata, plus the plan. `canvas` is the label.
|
|
@@ -596,6 +597,7 @@ def encode_remote(
|
|
| 596 |
semantic_bridge=bool(semantic_bridge),
|
| 597 |
semantic_bridge_alpha=float(semantic_bridge_alpha),
|
| 598 |
semantic_bridge_magnitude_match=semantic_bridge_magnitude_match,
|
|
|
|
| 599 |
api_name="/encode",
|
| 600 |
)
|
| 601 |
with safe_open(path, framework="pt") as handle:
|
|
@@ -881,6 +883,7 @@ def generate(
|
|
| 881 |
semantic_bridge=False,
|
| 882 |
semantic_bridge_alpha=0.10,
|
| 883 |
semantic_bridge_magnitude_match="per_token",
|
|
|
|
| 884 |
progress=gr.Progress(track_tqdm=True),
|
| 885 |
*,
|
| 886 |
advance: bool = False,
|
|
@@ -989,6 +992,7 @@ def generate(
|
|
| 989 |
prompt, effective_first_frame, effective_last_frame, canvas, num_frames, rewrite_prompt=upsample,
|
| 990 |
semantic_bridge=semantic_bridge, semantic_bridge_alpha=semantic_bridge_alpha,
|
| 991 |
semantic_bridge_magnitude_match=semantic_bridge_magnitude_match,
|
|
|
|
| 992 |
)
|
| 993 |
condition_seconds = time.time() - conditioned
|
| 994 |
height, width, num_frames = (int(metadata[key]) for key in ("height", "width", "num_frames"))
|
|
@@ -1066,7 +1070,7 @@ def generate(
|
|
| 1066 |
f"seed {int(seed)}",
|
| 1067 |
]
|
| 1068 |
if plan.get("semantic_bridge"):
|
| 1069 |
-
info.append(f"Semantic Bridge {float(semantic_bridge_alpha):.2f}")
|
| 1070 |
if stage_enabled:
|
| 1071 |
info.append(f"staged {steps_done_after}/{int(target_steps)} steps")
|
| 1072 |
if lora_text:
|
|
@@ -1409,6 +1413,14 @@ with gr.Blocks(title="PlagueKind 路 MiniMax-H3") as demo:
|
|
| 1409 |
value="per_token",
|
| 1410 |
visible=False,
|
| 1411 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1412 |
maximize_gpu = gr.Checkbox(
|
| 1413 |
label="Maximize Free Tier ZeroGPU (150 seconds)",
|
| 1414 |
value=False,
|
|
@@ -1604,9 +1616,9 @@ with gr.Blocks(title="PlagueKind 路 MiniMax-H3") as demo:
|
|
| 1604 |
api_name=False,
|
| 1605 |
)
|
| 1606 |
semantic_bridge.change(
|
| 1607 |
-
lambda enabled: tuple(gr.update(visible=enabled) for _ in range(
|
| 1608 |
semantic_bridge,
|
| 1609 |
-
[semantic_bridge_alpha, semantic_bridge_magnitude_match],
|
| 1610 |
api_name=False,
|
| 1611 |
)
|
| 1612 |
|
|
@@ -1651,6 +1663,7 @@ with gr.Blocks(title="PlagueKind 路 MiniMax-H3") as demo:
|
|
| 1651 |
semantic_bridge,
|
| 1652 |
semantic_bridge_alpha,
|
| 1653 |
semantic_bridge_magnitude_match,
|
|
|
|
| 1654 |
]
|
| 1655 |
|
| 1656 |
# `functools.partial` binds `advance`/`chunk_advance` by keyword regardless of their position in `generate`'s
|
|
|
|
| 575 |
def encode_remote(
|
| 576 |
prompt, image_path, last_image_path, canvas, num_frames, rewrite_prompt=False,
|
| 577 |
semantic_bridge=False, semantic_bridge_alpha=0.10, semantic_bridge_magnitude_match="per_token",
|
| 578 |
+
semantic_bridge_adapter="semantic_bridge_v1",
|
| 579 |
):
|
| 580 |
"""`/encode` on the conditioner Space: a safetensors file holding `prompt_embeds` + `text_token_tags`, with the
|
| 581 |
resolved `height` / `width` / `num_frames` in its metadata, plus the plan. `canvas` is the label.
|
|
|
|
| 597 |
semantic_bridge=bool(semantic_bridge),
|
| 598 |
semantic_bridge_alpha=float(semantic_bridge_alpha),
|
| 599 |
semantic_bridge_magnitude_match=semantic_bridge_magnitude_match,
|
| 600 |
+
semantic_bridge_adapter=semantic_bridge_adapter,
|
| 601 |
api_name="/encode",
|
| 602 |
)
|
| 603 |
with safe_open(path, framework="pt") as handle:
|
|
|
|
| 883 |
semantic_bridge=False,
|
| 884 |
semantic_bridge_alpha=0.10,
|
| 885 |
semantic_bridge_magnitude_match="per_token",
|
| 886 |
+
semantic_bridge_adapter="semantic_bridge_v1",
|
| 887 |
progress=gr.Progress(track_tqdm=True),
|
| 888 |
*,
|
| 889 |
advance: bool = False,
|
|
|
|
| 992 |
prompt, effective_first_frame, effective_last_frame, canvas, num_frames, rewrite_prompt=upsample,
|
| 993 |
semantic_bridge=semantic_bridge, semantic_bridge_alpha=semantic_bridge_alpha,
|
| 994 |
semantic_bridge_magnitude_match=semantic_bridge_magnitude_match,
|
| 995 |
+
semantic_bridge_adapter=semantic_bridge_adapter,
|
| 996 |
)
|
| 997 |
condition_seconds = time.time() - conditioned
|
| 998 |
height, width, num_frames = (int(metadata[key]) for key in ("height", "width", "num_frames"))
|
|
|
|
| 1070 |
f"seed {int(seed)}",
|
| 1071 |
]
|
| 1072 |
if plan.get("semantic_bridge"):
|
| 1073 |
+
info.append(f"Semantic Bridge `{plan.get('semantic_bridge_adapter')}` {float(semantic_bridge_alpha):.2f}")
|
| 1074 |
if stage_enabled:
|
| 1075 |
info.append(f"staged {steps_done_after}/{int(target_steps)} steps")
|
| 1076 |
if lora_text:
|
|
|
|
| 1413 |
value="per_token",
|
| 1414 |
visible=False,
|
| 1415 |
)
|
| 1416 |
+
semantic_bridge_adapter = gr.Dropdown(
|
| 1417 |
+
label="adapter",
|
| 1418 |
+
choices=["semantic_bridge_v1", "bunny_action_logic_v1"],
|
| 1419 |
+
value="semantic_bridge_v1",
|
| 1420 |
+
visible=False,
|
| 1421 |
+
info="semantic_bridge_v1: broad (composition, spatial, materials). "
|
| 1422 |
+
"bunny_action_logic_v1: action/combat, character-action ownership in multi-character scenes.",
|
| 1423 |
+
)
|
| 1424 |
maximize_gpu = gr.Checkbox(
|
| 1425 |
label="Maximize Free Tier ZeroGPU (150 seconds)",
|
| 1426 |
value=False,
|
|
|
|
| 1616 |
api_name=False,
|
| 1617 |
)
|
| 1618 |
semantic_bridge.change(
|
| 1619 |
+
lambda enabled: tuple(gr.update(visible=enabled) for _ in range(3)),
|
| 1620 |
semantic_bridge,
|
| 1621 |
+
[semantic_bridge_alpha, semantic_bridge_magnitude_match, semantic_bridge_adapter],
|
| 1622 |
api_name=False,
|
| 1623 |
)
|
| 1624 |
|
|
|
|
| 1663 |
semantic_bridge,
|
| 1664 |
semantic_bridge_alpha,
|
| 1665 |
semantic_bridge_magnitude_match,
|
| 1666 |
+
semantic_bridge_adapter,
|
| 1667 |
]
|
| 1668 |
|
| 1669 |
# `functools.partial` binds `advance`/`chunk_advance` by keyword regardless of their position in `generate`'s
|