Skip to content

Commit a913f01

Browse files
RyanJDickpsychedelicious
authored andcommitted
WIP - Add FluxFillInvocation
1 parent f7cfbd1 commit a913f01

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

invokeai/app/invocations/fields.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ class FieldDescriptions:
207207
instantx_control_mode = "The control mode for InstantX ControlNet union models. Ignored for other ControlNet models. The standard mapping is: canny (0), tile (1), depth (2), blur (3), pose (4), gray (5), low quality (6). Negative values will be treated as 'None'."
208208
flux_redux_conditioning = "FLUX Redux conditioning tensor"
209209
vllm_model = "The VLLM model to use"
210+
flux_fill_conditioning = "FLUX Fill conditioning tensor"
210211

211212

212213
class ImageField(BaseModel):
@@ -276,6 +277,13 @@ class FluxReduxConditioningField(BaseModel):
276277
)
277278

278279

280+
class FluxFillConditioningField(BaseModel):
281+
"""A FLUX Fill conditioning field."""
282+
283+
image: ImageField = Field(description="The FLUX Fill reference image.")
284+
mask: TensorField = Field(description="The FLUX Fill inpaint mask.")
285+
286+
279287
class SD3ConditioningField(BaseModel):
280288
"""A conditioning tensor primitive value"""
281289

invokeai/app/invocations/flux_denoise.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
DenoiseMaskField,
1616
FieldDescriptions,
1717
FluxConditioningField,
18+
FluxFillConditioningField,
1819
FluxReduxConditioningField,
1920
ImageField,
2021
Input,
@@ -109,6 +110,11 @@ class FluxDenoiseInvocation(BaseInvocation, WithMetadata, WithBoard):
109110
description="FLUX Redux conditioning tensor.",
110111
input=Input.Connection,
111112
)
113+
fill_conditioning: FluxFillConditioningField | None = InputField(
114+
default=None,
115+
description="FLUX Fill conditioning.",
116+
input=Input.Connection,
117+
)
112118
cfg_scale: float | list[float] = InputField(default=1.0, description=FieldDescriptions.cfg_scale, title="CFG Scale")
113119
cfg_scale_start_step: int = InputField(
114120
default=0,

invokeai/app/invocations/flux_fill.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
from invokeai.app.invocations.baseinvocation import (
2+
BaseInvocation,
3+
BaseInvocationOutput,
4+
Classification,
5+
invocation,
6+
invocation_output,
7+
)
8+
from invokeai.app.invocations.fields import (
9+
FieldDescriptions,
10+
FluxFillConditioningField,
11+
InputField,
12+
OutputField,
13+
TensorField,
14+
)
15+
from invokeai.app.invocations.primitives import ImageField
16+
from invokeai.app.services.shared.invocation_context import InvocationContext
17+
18+
19+
@invocation_output("flux_fill_output")
20+
class FluxFillOutput(BaseInvocationOutput):
21+
"""The conditioning output of a FLUX Fill invocation."""
22+
23+
fill_cond: FluxFillConditioningField = OutputField(
24+
description=FieldDescriptions.flux_redux_conditioning, title="Conditioning"
25+
)
26+
27+
28+
@invocation(
29+
"flux_fill",
30+
title="FLUX Fill",
31+
tags=["inpaint"],
32+
category="inpaint",
33+
version="1.0.0",
34+
classification=Classification.Prototype,
35+
)
36+
class FluxFillInvocation(BaseInvocation):
37+
"""Prepare the FLUX Fill conditioning data."""
38+
39+
image: ImageField = InputField(description="The FLUX Fill reference image.")
40+
mask: TensorField = InputField(
41+
description="The bool inpainting mask. Excluded regions should be set to "
42+
"False, included regions should be set to True.",
43+
)
44+
45+
def invoke(self, context: InvocationContext) -> FluxFillOutput:
46+
return FluxFillOutput(fill_cond=FluxFillConditioningField(image=self.image, mask=self.mask))

0 commit comments

Comments
 (0)