Spaces:
Runtime error
Runtime error
Andrei Cozma
commited on
Commit
·
183418a
1
Parent(s):
d3df19a
Updates
Browse files
app.py
CHANGED
@@ -71,10 +71,7 @@ def pad_image_nextpow2(image):
|
|
71 |
print("pad_image_nextpow2: ")
|
72 |
print(ImageInfo.from_any(image))
|
73 |
|
74 |
-
|
75 |
-
image = image[:, :, np.newaxis]
|
76 |
-
|
77 |
-
assert image.ndim == 3, f"Expected image.ndim == 3. Got {image.ndim}"
|
78 |
|
79 |
height, width, channels = image.shape
|
80 |
height_new = nextpow2(height)
|
@@ -89,6 +86,11 @@ def pad_image_nextpow2(image):
|
|
89 |
(height_diff // 2, height_diff - height_diff // 2),
|
90 |
(width_diff // 2, width_diff - width_diff // 2),
|
91 |
(0, 0),
|
|
|
|
|
|
|
|
|
|
|
92 |
),
|
93 |
mode="constant",
|
94 |
# mode="edge",
|
|
|
71 |
print("pad_image_nextpow2: ")
|
72 |
print(ImageInfo.from_any(image))
|
73 |
|
74 |
+
assert image.ndim in (2, 3), f"Expected 2D or 3D image. Got {image.ndim}D."
|
|
|
|
|
|
|
75 |
|
76 |
height, width, channels = image.shape
|
77 |
height_new = nextpow2(height)
|
|
|
86 |
(height_diff // 2, height_diff - height_diff // 2),
|
87 |
(width_diff // 2, width_diff - width_diff // 2),
|
88 |
(0, 0),
|
89 |
+
)
|
90 |
+
if channels == 3
|
91 |
+
else (
|
92 |
+
(height_diff // 2, height_diff - height_diff // 2),
|
93 |
+
(width_diff // 2, width_diff - width_diff // 2),
|
94 |
),
|
95 |
mode="constant",
|
96 |
# mode="edge",
|