fffiloni commited on
Commit
6b8527f
·
verified ·
1 Parent(s): 80de7b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -321,7 +321,10 @@ def infer_compo(style_description, ref_style_file, caption, ref_sub_file):
321
  use_sam_mask = False
322
  x0_preview = models_rbm.previewer(x0_forward)
323
  sam_model = LangSAM()
324
- sam_mask, boxes, phrases, logits = sam_model.predict(transform(x0_preview[0]), sam_prompt)
 
 
 
325
  sam_mask = sam_mask.detach().unsqueeze(dim=0).to(device)
326
 
327
  conditions = core.get_conditions(batch, models_rbm, extras, is_eval=True, is_unconditional=False, eval_image_embeds=True, eval_subject_style=True, eval_csd=False)
 
321
  use_sam_mask = False
322
  x0_preview = models_rbm.previewer(x0_forward)
323
  sam_model = LangSAM()
324
+
325
+ # Convert tensor to PIL Image before passing to sam_model.predict
326
+ x0_preview_pil = T.ToPILImage()(x0_preview[0])
327
+ sam_mask, boxes, phrases, logits = sam_model.predict(x0_preview_pil, sam_prompt)
328
  sam_mask = sam_mask.detach().unsqueeze(dim=0).to(device)
329
 
330
  conditions = core.get_conditions(batch, models_rbm, extras, is_eval=True, is_unconditional=False, eval_image_embeds=True, eval_subject_style=True, eval_csd=False)