Spaces:
Build error
Build error
resizing mask to original image shape
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ model = tf.keras.models.load_model("./tf_model.h5")
|
|
13 |
|
14 |
def predict(image):
|
15 |
img = np.array(image)
|
16 |
-
|
17 |
|
18 |
im = tf.image.resize(img, (128, 128))
|
19 |
im = tf.cast(im, tf.float32) / 255.0
|
@@ -54,6 +54,7 @@ def predict(image):
|
|
54 |
mask *= 255
|
55 |
|
56 |
mask = np.array(Image.fromarray(mask).convert("L"))
|
|
|
57 |
|
58 |
return mask
|
59 |
|
|
|
13 |
|
14 |
def predict(image):
|
15 |
img = np.array(image)
|
16 |
+
original_shape = img.shape[:2]
|
17 |
|
18 |
im = tf.image.resize(img, (128, 128))
|
19 |
im = tf.cast(im, tf.float32) / 255.0
|
|
|
54 |
mask *= 255
|
55 |
|
56 |
mask = np.array(Image.fromarray(mask).convert("L"))
|
57 |
+
mask = np.resize(mask, original_shape)
|
58 |
|
59 |
return mask
|
60 |
|