Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,11 +14,9 @@ def predict_segmentation(image):
|
|
14 |
SIZE_X = 128
|
15 |
SIZE_Y = 128
|
16 |
|
17 |
-
|
18 |
train_images = []
|
19 |
-
|
20 |
-
img = cv2.
|
21 |
-
img = cv2.resize(img, (SIZE_Y, SIZE_X))
|
22 |
train_images.append(img)
|
23 |
|
24 |
train_images = np.array(train_images)
|
@@ -54,24 +52,6 @@ def predict_segmentation(image):
|
|
54 |
alpha_channel = np.where(predicted_img > 0, 1, 0)
|
55 |
rgba_img[:, :, 3] = alpha_channel
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
# img = cv2.resize(image, (SIZE_Y, SIZE_X))
|
65 |
-
# img = np.expand_dims(img, axis=2)
|
66 |
-
# img = normalize(img, axis=1)
|
67 |
-
|
68 |
-
# # Prepare image for prediction
|
69 |
-
# img = np.expand_dims(img, axis=0)
|
70 |
-
|
71 |
-
# # Predict
|
72 |
-
# prediction = model.predict(img)
|
73 |
-
# predicted_img = np.argmax(prediction, axis=3)[0, :, :]
|
74 |
-
|
75 |
return rgba_img
|
76 |
|
77 |
|
|
|
14 |
SIZE_X = 128
|
15 |
SIZE_Y = 128
|
16 |
|
|
|
17 |
train_images = []
|
18 |
+
|
19 |
+
img = cv2.resize(image, (SIZE_Y, SIZE_X))
|
|
|
20 |
train_images.append(img)
|
21 |
|
22 |
train_images = np.array(train_images)
|
|
|
52 |
alpha_channel = np.where(predicted_img > 0, 1, 0)
|
53 |
rgba_img[:, :, 3] = alpha_channel
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
return rgba_img
|
56 |
|
57 |
|