MetricMogul commited on
Commit
4dcec2d
·
verified ·
1 Parent(s): 1b6f1c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -12
app.py CHANGED
@@ -306,18 +306,10 @@ def generate(
306
  )
307
 
308
  if ip_slot is not None:
309
- # Prepare image embeddings explicitly. This avoids a known shape-mismatch
310
- # bug in some diffusers versions when ip_adapter_image is passed raw alongside
311
- # certain ControlNet configurations. Returns a list of tensors (one per
312
- # IP-Adapter), which is what the attention processor expects.
313
- ip_embeds = pipe.prepare_ip_adapter_image_embeds(
314
- ip_adapter_image=ip_image,
315
- ip_adapter_image_embeds=None,
316
- device=DEVICE,
317
- num_images_per_prompt=1,
318
- do_classifier_free_guidance=True,
319
- )
320
- call_kwargs["ip_adapter_image_embeds"] = ip_embeds
321
 
322
  # 4. Run generation
323
  result = pipe(**call_kwargs).images[0]
 
306
  )
307
 
308
  if ip_slot is not None:
309
+ # diffusers 0.27.2 accepts a raw PIL image here; CLIP encoding happens
310
+ # internally. The shape-mismatch bug we saw earlier appeared in newer
311
+ # versions, which is why diffusers is pinned in requirements.txt.
312
+ call_kwargs["ip_adapter_image"] = ip_image
 
 
 
 
 
 
 
 
313
 
314
  # 4. Run generation
315
  result = pipe(**call_kwargs).images[0]