Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Canvas: the Remove background node takes what to keep or drop from a text node for Bria's guided cut-out

Claudec6c90c7cd793
diff --git a/src/lib/catalog/canvas.ts b/src/lib/catalog/canvas.ts
index 6eabd06b..74ef1017 100644
--- a/src/lib/catalog/canvas.ts
+++ b/src/lib/catalog/canvas.ts
@@ -584,6 +584,8 @@ export function inputPorts(n: Pick<CanvasNode, "type" | "data">): PortDef[] {
if (ids.has("voice") && model && !model.options.voiceClone && n.type !== "tts" && n.type !== "voice-change") ids.delete("voice");
// A model that redraws from words even where its operation takes none (Open-H3 Regenerate on the Upscale node).
if (model?.options.requires?.prompt) ids.add("prompt");
+ // A cut-out that reads optional words on what to keep or drop (Bria's guided cut-out on Remove background).
+ if (model?.options.guided) ids.add("prompt");
// Visual elements only on image and video models.
if (ids.has("elements") && model && model.kind !== "image" && model.kind !== "video") ids.delete("elements");
const maxImages = model?.options.maxImages ?? (ops.some((op) => MULTI_IMAGE_OPS.has(op)) ? 4 : 1);
diff --git a/tests/keying.test.ts b/tests/keying.test.ts
index 709988fa..ab668ff7 100644
--- a/tests/keying.test.ts
+++ b/tests/keying.test.ts
@@ -226,6 +226,25 @@ describe("image cut-outs", () => {
// Both are bg-remove models, so the Canvas node and the model picker list them too.
expect(modelsFor({ kind: "image", ops: ["bg-remove"] }).map((m) => m.id)).toEqual(expect.arrayContaining(["oss-matte-feynobg", "bria-guided-cutout"]));
});
+
+ it("the Canvas Remove background node takes the guided cut-out's words from a text node", async () => {
+ const { describeNode, inputPorts } = await import("@/lib/catalog/canvas");
+ const at = { x: 0, y: 0 };
+ const cut = { id: "cut", type: "bg-remove" as const, position: at, data: { mediaKind: "image" as const, modelId: "bria-guided-cutout" } };
+ expect(inputPorts(cut).map((p) => p.id)).toEqual(["prompt", "images"]);
+ // Plain cut-outs take a picture only.
+ expect(inputPorts({ ...cut, data: { ...cut.data, modelId: "birefnet-cloud" } }).map((p) => p.id)).toEqual(["images"]);
+ const graph = {
+ nodes: [{ id: "pic", type: "image-input" as const, position: at, data: { url: "/api/files/u/p.png" } }, { id: "words", type: "prompt" as const, position: at, data: { text: "keep the shadow" } }, cut],
+ edges: [
+ { id: "e1", source: "pic", sourceHandle: "out", target: "cut", targetHandle: "images" },
+ { id: "e2", source: "words", sourceHandle: "out", target: "cut", targetHandle: "prompt" },
+ ],
+ };
+ const d = describeNode(graph as never, cut as never, { engineMode: "cloud" });
+ expect(d.error).toBeUndefined();
+ expect(d.request).toMatchObject({ modelId: "bria-guided-cutout", op: "bg-remove", prompt: "keep the shadow", inputs: { images: ["/api/files/u/p.png"] } });
+ });
});
describe("a matte's way to the edit", () => {