Commit
·
7b635eb
1
Parent(s):
68ae54e
Update app.py
Browse files
app.py
CHANGED
@@ -63,13 +63,13 @@ def gen_pred(img, model=seg_model):
|
|
63 |
img = img/255
|
64 |
img = tf.expand_dims(img, axis=0)
|
65 |
pred = model.predict(img)
|
66 |
-
|
67 |
-
|
68 |
# img_bytes = pred.tobytes()
|
69 |
# nparr = np.frombuffer(img_bytes, np.byte)
|
70 |
# pred_pil = cv2.imdecode(nparr, cv2.IMREAD_REDUCED_COLOR_8)
|
71 |
# return "UI in developing process ..."
|
72 |
-
return
|
73 |
|
74 |
title = "<h1 style='text-align: center;'>Semantic Segmentation</h1>"
|
75 |
description = "Upload an image and get prediction mask"
|
|
|
63 |
img = img/255
|
64 |
img = tf.expand_dims(img, axis=0)
|
65 |
pred = model.predict(img)
|
66 |
+
pred = np.squeeze(pred, axis=0)
|
67 |
+
im = Image.fromarray((pred * 255).astype(np.uint8))
|
68 |
# img_bytes = pred.tobytes()
|
69 |
# nparr = np.frombuffer(img_bytes, np.byte)
|
70 |
# pred_pil = cv2.imdecode(nparr, cv2.IMREAD_REDUCED_COLOR_8)
|
71 |
# return "UI in developing process ..."
|
72 |
+
return im
|
73 |
|
74 |
title = "<h1 style='text-align: center;'>Semantic Segmentation</h1>"
|
75 |
description = "Upload an image and get prediction mask"
|