Spaces:
Runtime error
Runtime error
Make the comparison effect of the results more obvious (#3)
Browse files- Make the comparison effect of the results more obvious (4fa545c5a3bfba54abaa5e0862805b17047cb758)
Co-authored-by: sky <[email protected]>
app.py
CHANGED
|
@@ -77,9 +77,9 @@ def predict(image, resolution='1024x1024'):
|
|
| 77 |
preds.append(torch.nn.functional.interpolate(pred_tensor.unsqueeze(0), size=image_shape, mode='bilinear', align_corners=True).squeeze().numpy())
|
| 78 |
image_preds = []
|
| 79 |
for image, pred in zip(images, preds):
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
)
|
| 83 |
|
| 84 |
return image, image_preds[0]
|
| 85 |
|
|
|
|
| 77 |
preds.append(torch.nn.functional.interpolate(pred_tensor.unsqueeze(0), size=image_shape, mode='bilinear', align_corners=True).squeeze().numpy())
|
| 78 |
image_preds = []
|
| 79 |
for image, pred in zip(images, preds):
|
| 80 |
+
image = image.resize(pred.shape[::-1])
|
| 81 |
+
pred = np.repeat(np.expand_dims(pred, axis=-1), 3, axis=-1)
|
| 82 |
+
image_preds.append((pred * image).astype(np.uint8))
|
| 83 |
|
| 84 |
return image, image_preds[0]
|
| 85 |
|