Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
| 194 |
|
| 195 |
# 结果后处理
|
| 196 |
side = max(back_image.shape[0], back_image.shape[1])
|
| 197 |
-
pred = cv2.resize(
|
| 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 |
|