aleph65 commited on
Commit
297f088
·
verified ·
1 Parent(s): afe5752

Add flux2-bg-inpaint API workflow

Browse files
Files changed (1) hide show
  1. workflows/api/flux2-bg-inpaint.json +333 -0
workflows/api/flux2-bg-inpaint.json ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "1": {
3
+ "_meta": {
4
+ "title": "Load Flux2 Klein"
5
+ },
6
+ "class_type": "UNETLoader",
7
+ "inputs": {
8
+ "unet_name": "flux-2-klein-9b.safetensors",
9
+ "weight_dtype": "default"
10
+ }
11
+ },
12
+ "10": {
13
+ "_meta": {
14
+ "title": "Background prompt"
15
+ },
16
+ "class_type": "CLIPTextEncode",
17
+ "inputs": {
18
+ "clip": [
19
+ "2",
20
+ 0
21
+ ],
22
+ "text": "sharp photorealistic background, same scene, evenly lit, uniform soft lighting matching the subject, no added shadows, no vignetting, crisp focus, fine natural texture, clean detail, no blur, no artifacts, high detail, 4k"
23
+ }
24
+ },
25
+ "11": {
26
+ "class_type": "ReferenceLatent",
27
+ "inputs": {
28
+ "conditioning": [
29
+ "10",
30
+ 0
31
+ ],
32
+ "latent": [
33
+ "6",
34
+ 0
35
+ ]
36
+ }
37
+ },
38
+ "12": {
39
+ "_meta": {
40
+ "title": "Negative (zeroed)"
41
+ },
42
+ "class_type": "ConditioningZeroOut",
43
+ "inputs": {
44
+ "conditioning": [
45
+ "10",
46
+ 0
47
+ ]
48
+ }
49
+ },
50
+ "13": {
51
+ "class_type": "CFGGuider",
52
+ "inputs": {
53
+ "cfg": 1.0,
54
+ "model": [
55
+ "1",
56
+ 0
57
+ ],
58
+ "negative": [
59
+ "12",
60
+ 0
61
+ ],
62
+ "positive": [
63
+ "11",
64
+ 0
65
+ ]
66
+ }
67
+ },
68
+ "14": {
69
+ "class_type": "Flux2Scheduler",
70
+ "inputs": {
71
+ "height": [
72
+ "5",
73
+ 2
74
+ ],
75
+ "steps": 8,
76
+ "width": [
77
+ "5",
78
+ 1
79
+ ]
80
+ }
81
+ },
82
+ "15": {
83
+ "class_type": "KSamplerSelect",
84
+ "inputs": {
85
+ "sampler_name": "euler"
86
+ }
87
+ },
88
+ "16": {
89
+ "class_type": "RandomNoise",
90
+ "inputs": {
91
+ "noise_seed": 156680208700286
92
+ }
93
+ },
94
+ "17": {
95
+ "class_type": "SamplerCustomAdvanced",
96
+ "inputs": {
97
+ "guider": [
98
+ "13",
99
+ 0
100
+ ],
101
+ "latent_image": [
102
+ "9",
103
+ 0
104
+ ],
105
+ "noise": [
106
+ "16",
107
+ 0
108
+ ],
109
+ "sampler": [
110
+ "15",
111
+ 0
112
+ ],
113
+ "sigmas": [
114
+ "24",
115
+ 1
116
+ ]
117
+ }
118
+ },
119
+ "18": {
120
+ "class_type": "VAEDecode",
121
+ "inputs": {
122
+ "samples": [
123
+ "17",
124
+ 0
125
+ ],
126
+ "vae": [
127
+ "3",
128
+ 0
129
+ ]
130
+ }
131
+ },
132
+ "19": {
133
+ "_meta": {
134
+ "title": "Person keep mask (grow+feather)"
135
+ },
136
+ "class_type": "GrowMaskWithBlur",
137
+ "inputs": {
138
+ "blur_radius": 12.0,
139
+ "decay_factor": 1.0,
140
+ "expand": 6,
141
+ "fill_holes": true,
142
+ "flip_input": false,
143
+ "incremental_expandrate": 0.0,
144
+ "lerp_alpha": 1.0,
145
+ "mask": [
146
+ "7",
147
+ 1
148
+ ],
149
+ "tapered_corners": true
150
+ }
151
+ },
152
+ "2": {
153
+ "class_type": "CLIPLoader",
154
+ "inputs": {
155
+ "clip_name": "qwen_3_8b_fp8mixed.safetensors",
156
+ "device": "default",
157
+ "type": "flux2"
158
+ }
159
+ },
160
+ "20": {
161
+ "_meta": {
162
+ "title": "Resize to original size"
163
+ },
164
+ "class_type": "ImageResizeKJ",
165
+ "inputs": {
166
+ "crop": "disabled",
167
+ "divisible_by": 0,
168
+ "get_image_size": [
169
+ "4",
170
+ 0
171
+ ],
172
+ "height": 1024,
173
+ "image": [
174
+ "18",
175
+ 0
176
+ ],
177
+ "keep_proportion": false,
178
+ "upscale_method": "lanczos",
179
+ "width": 1024
180
+ }
181
+ },
182
+ "21": {
183
+ "_meta": {
184
+ "title": "Original person over new background"
185
+ },
186
+ "class_type": "ImageCompositeMasked",
187
+ "inputs": {
188
+ "destination": [
189
+ "20",
190
+ 0
191
+ ],
192
+ "mask": [
193
+ "19",
194
+ 0
195
+ ],
196
+ "resize_source": false,
197
+ "source": [
198
+ "4",
199
+ 0
200
+ ],
201
+ "x": 0,
202
+ "y": 0
203
+ }
204
+ },
205
+ "22": {
206
+ "_meta": {
207
+ "title": "Save Image"
208
+ },
209
+ "class_type": "SaveImage",
210
+ "inputs": {
211
+ "filename_prefix": "flux2-bg-inpaint",
212
+ "images": [
213
+ "21",
214
+ 0
215
+ ]
216
+ }
217
+ },
218
+ "24": {
219
+ "_meta": {
220
+ "title": "partial denoise"
221
+ },
222
+ "class_type": "SplitSigmasDenoise",
223
+ "inputs": {
224
+ "denoise": 1.0,
225
+ "sigmas": [
226
+ "14",
227
+ 0
228
+ ]
229
+ }
230
+ },
231
+ "3": {
232
+ "class_type": "VAELoader",
233
+ "inputs": {
234
+ "vae_name": "flux2-vae.safetensors"
235
+ }
236
+ },
237
+ "4": {
238
+ "_meta": {
239
+ "title": "Main Image"
240
+ },
241
+ "class_type": "LoadImage",
242
+ "inputs": {
243
+ "image": "example.png"
244
+ }
245
+ },
246
+ "5": {
247
+ "_meta": {
248
+ "title": "Fit to /16"
249
+ },
250
+ "class_type": "ImageResizeKJ",
251
+ "inputs": {
252
+ "crop": "disabled",
253
+ "divisible_by": 16,
254
+ "height": 0,
255
+ "image": [
256
+ "4",
257
+ 0
258
+ ],
259
+ "keep_proportion": false,
260
+ "upscale_method": "lanczos",
261
+ "width": 0
262
+ }
263
+ },
264
+ "6": {
265
+ "class_type": "VAEEncode",
266
+ "inputs": {
267
+ "pixels": [
268
+ "5",
269
+ 0
270
+ ],
271
+ "vae": [
272
+ "3",
273
+ 0
274
+ ]
275
+ }
276
+ },
277
+ "7": {
278
+ "_meta": {
279
+ "title": "Segment PERSON (SAM3)"
280
+ },
281
+ "class_type": "SAM3Segment",
282
+ "inputs": {
283
+ "background": "Alpha",
284
+ "confidence_threshold": 0.5,
285
+ "device": "Auto",
286
+ "image": [
287
+ "4",
288
+ 0
289
+ ],
290
+ "invert_output": false,
291
+ "mask_blur": 0,
292
+ "mask_offset": 0,
293
+ "max_segments": 0,
294
+ "output_mode": "Merged",
295
+ "prompt": "person",
296
+ "segment_pick": 0,
297
+ "unload_model": false
298
+ }
299
+ },
300
+ "8": {
301
+ "_meta": {
302
+ "title": "Background mask (inverted)"
303
+ },
304
+ "class_type": "GrowMaskWithBlur",
305
+ "inputs": {
306
+ "blur_radius": 8.0,
307
+ "decay_factor": 1.0,
308
+ "expand": -4,
309
+ "fill_holes": true,
310
+ "flip_input": false,
311
+ "incremental_expandrate": 0.0,
312
+ "lerp_alpha": 1.0,
313
+ "mask": [
314
+ "7",
315
+ 1
316
+ ],
317
+ "tapered_corners": true
318
+ }
319
+ },
320
+ "9": {
321
+ "class_type": "SetLatentNoiseMask",
322
+ "inputs": {
323
+ "mask": [
324
+ "8",
325
+ 1
326
+ ],
327
+ "samples": [
328
+ "6",
329
+ 0
330
+ ]
331
+ }
332
+ }
333
+ }