Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -42,13 +42,14 @@ def process_img(image):
|
|
42 |
img = np.array(image)
|
43 |
img = img / 255.
|
44 |
img = img.astype(np.float32)
|
|
|
|
|
|
|
|
|
45 |
y = torch.tensor(img).permute(2,0,1).unsqueeze(0).to(device)
|
46 |
-
_, _, H, W = y.shape
|
47 |
-
y= check_image_size(y)
|
48 |
|
49 |
with torch.no_grad():
|
50 |
x_hat = model(y)
|
51 |
-
x_hat = x_hat[:, :, :H, :W]
|
52 |
|
53 |
restored_img = x_hat.squeeze().permute(1,2,0).clamp_(0, 1).cpu().detach().numpy()
|
54 |
restored_img = np.clip(restored_img, 0. , 1.)
|
|
|
42 |
img = np.array(image)
|
43 |
img = img / 255.
|
44 |
img = img.astype(np.float32)
|
45 |
+
|
46 |
+
resize = transforms.Resize((720, 1280))
|
47 |
+
mask_rgb = resize(mask_rgb)
|
48 |
+
|
49 |
y = torch.tensor(img).permute(2,0,1).unsqueeze(0).to(device)
|
|
|
|
|
50 |
|
51 |
with torch.no_grad():
|
52 |
x_hat = model(y)
|
|
|
53 |
|
54 |
restored_img = x_hat.squeeze().permute(1,2,0).clamp_(0, 1).cpu().detach().numpy()
|
55 |
restored_img = np.clip(restored_img, 0. , 1.)
|