Spaces:
Runtime error
Runtime error
F-G Fernandez
commited on
Commit
•
6346a81
1
Parent(s):
d2e9ec0
fix: Fixed PIL resizing
Browse files
app.py
CHANGED
@@ -31,8 +31,8 @@ def preprocess_image(pil_img: Image.Image) -> np.ndarray:
|
|
31 |
the resized and normalized image of shape (1, C, H, W)
|
32 |
"""
|
33 |
|
34 |
-
# Resizing
|
35 |
-
img = pil_img.resize(cfg["input_shape"][-2:], Image.BILINEAR)
|
36 |
# (H, W, C) --> (C, H, W)
|
37 |
img = np.asarray(img).transpose((2, 0, 1)).astype(np.float32) / 255
|
38 |
# Normalization
|
|
|
31 |
the resized and normalized image of shape (1, C, H, W)
|
32 |
"""
|
33 |
|
34 |
+
# Resizing (PIL takes (W, H) order for resizing)
|
35 |
+
img = pil_img.resize(cfg["input_shape"][-2:][::-1], Image.BILINEAR)
|
36 |
# (H, W, C) --> (C, H, W)
|
37 |
img = np.asarray(img).transpose((2, 0, 1)).astype(np.float32) / 255
|
38 |
# Normalization
|