RyanHangZhou commited on
Commit
ff8dd04
·
verified ·
1 Parent(s): d4c5a1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -190,11 +190,13 @@ def pics_pairwise_inference(background, img_a, mask_a, img_b, mask_b):
190
 
191
  x_samples = model.decode_first_stage(samples)
192
  x_samples = (einops.rearrange(x_samples, 'b c h w -> b h w c') * 127.5 + 127.5).cpu().numpy()
193
- pred = np.clip(x_samples[0], 0, 255).astype(np.uint8)
 
 
194
 
195
  # 结果后处理
196
  side = max(back_image.shape[0], back_image.shape[1])
197
- pred = cv2.resize(pred, (side, side))
198
  pred = crop_back(pred, back_image, item_with_collage['extra_sizes'],
199
  item_with_collage['hint_sizes0'], item_with_collage['hint_sizes1'], is_masked=True)
200
 
 
190
 
191
  x_samples = model.decode_first_stage(samples)
192
  x_samples = (einops.rearrange(x_samples, 'b c h w -> b h w c') * 127.5 + 127.5).cpu().numpy()
193
+ pred_rgb = np.clip(x_samples[0], 0, 255).astype(np.uint8)
194
+
195
+ pred_bgr = cv2.cvtColor(pred_rgb, cv2.COLOR_RGB2BGR)
196
 
197
  # 结果后处理
198
  side = max(back_image.shape[0], back_image.shape[1])
199
+ pred = cv2.resize(pred_bgr, (side, side))
200
  pred = crop_back(pred, back_image, item_with_collage['extra_sizes'],
201
  item_with_collage['hint_sizes0'], item_with_collage['hint_sizes1'], is_masked=True)
202