Commit
·
5a36cdc
1
Parent(s):
8d2b059
Update app.py
Browse files
app.py
CHANGED
@@ -64,17 +64,7 @@ def gen_pred(img, model=seg_model):
|
|
64 |
img = img/255
|
65 |
img = tf.expand_dims(img, axis=0)
|
66 |
pred = model.predict(img)
|
67 |
-
|
68 |
-
# image = Image.fromarray(np.uint8(cm.plasma(pred)*255))
|
69 |
-
# pil_img = Image.fromarray(pred, 'RGB')
|
70 |
-
|
71 |
-
# importing Image from PIL
|
72 |
-
# img_tmp = cv2.cvtColor(pred, cv2.COLOR_BGR2RGB)
|
73 |
-
# im_PIL = Image.fromarray(img_tmp)
|
74 |
-
# im = Image.fromarray((pred * 255).astype(np.uint8))
|
75 |
-
# img_bytes = pred.tobytes()
|
76 |
-
# nparr = np.frombuffer(img_bytes, np.byte)
|
77 |
-
# pred_pil = cv2.imdecode(nparr, cv2.IMREAD_REDUCED_COLOR_8)
|
78 |
# return "UI in developing process ..."
|
79 |
return pred
|
80 |
|
@@ -84,7 +74,7 @@ description = "Upload an image and get prediction mask"
|
|
84 |
|
85 |
gr.Interface(fn=gen_pred,
|
86 |
inputs=[gr.Image(type='pil')],
|
87 |
-
outputs=
|
88 |
title=title,
|
89 |
examples=[["003e2c95d.jpg"], ["003b50a15.jpg"], ["003b48a9e.jpg"], ["0038cbe45.jpg"], ["00371aa92.jpg"]],
|
90 |
description=description,
|
|
|
64 |
img = img/255
|
65 |
img = tf.expand_dims(img, axis=0)
|
66 |
pred = model.predict(img)
|
67 |
+
pred = np.squeeze(pred, axis=0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
# return "UI in developing process ..."
|
69 |
return pred
|
70 |
|
|
|
74 |
|
75 |
gr.Interface(fn=gen_pred,
|
76 |
inputs=[gr.Image(type='pil')],
|
77 |
+
outputs=["plot"],
|
78 |
title=title,
|
79 |
examples=[["003e2c95d.jpg"], ["003b50a15.jpg"], ["003b48a9e.jpg"], ["0038cbe45.jpg"], ["00371aa92.jpg"]],
|
80 |
description=description,
|