File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -287,6 +287,21 @@ def predict(self, params: "Pipeline.InputParams") -> Image.Image:
287
287
for i in range (len (current_cfg )):
288
288
current_cfg [i ]['control_image' ] = params .image
289
289
self .stream .update_stream_params (controlnet_config = current_cfg )
290
+ # Also push T2I-Adapter control image in img2img when configured
291
+ if self .has_t2i and params .image is not None :
292
+ try :
293
+ t2i_module = getattr (self .stream .stream , '_t2i_adapter_module' , None )
294
+ if t2i_module is not None :
295
+ try :
296
+ num = len (getattr (t2i_module , 'controlnets' , []))
297
+ except Exception :
298
+ num = 0
299
+ if num > 0 :
300
+ t2i_cfg = [{'control_image' : params .image } for _ in range (num )]
301
+ print ("predict: updating T2I-Adapter control images for img2img" )
302
+ self .stream .update_stream_params (t2i_config = t2i_cfg )
303
+ except Exception :
304
+ pass
290
305
output_image = self .stream (params .image )
291
306
elif self .has_ipadapter :
292
307
# IPAdapter mode: use PIL image for img2img
You can’t perform that action at this time.
0 commit comments