Commit
·
480e7d1
1
Parent(s):
d3497cf
Update app.py
Browse files
app.py
CHANGED
@@ -48,7 +48,7 @@ def dice_coef(y_true, y_pred, smooth=1):
|
|
48 |
seg_model = tf.keras.models.load_model('seg_unet_model.h5', custom_objects={'Combo_loss': Combo_loss, 'dice_coef': dice_coef})
|
49 |
|
50 |
inputs = gr.inputs.Image(type="pil", label="Upload an image")
|
51 |
-
image_output = gr.outputs.Image(type="
|
52 |
# outputs = gr.outputs.HTML() #uncomment for single class output
|
53 |
|
54 |
|
@@ -67,7 +67,7 @@ def gen_pred(img=inputs, model=seg_model):
|
|
67 |
nparr = np.frombuffer(img_bytes, np.byte)
|
68 |
pred_pil = cv2.imdecode(nparr, cv2.IMREAD_REDUCED_COLOR_8)
|
69 |
# return "UI in developing process ..."
|
70 |
-
return
|
71 |
|
72 |
title = "<h1 style='text-align: center;'>Semantic Segmentation</h1>"
|
73 |
description = "Upload an image and get prediction mask"
|
@@ -75,7 +75,7 @@ description = "Upload an image and get prediction mask"
|
|
75 |
|
76 |
gr.Interface(fn=gen_pred,
|
77 |
inputs=inputs,
|
78 |
-
outputs=
|
79 |
title=title,
|
80 |
examples=[["003e2c95d.jpg"], ["003b50a15.jpg"], ["003b48a9e.jpg"], ["0038cbe45.jpg"], ["00371aa92.jpg"]],
|
81 |
description=description,
|
|
|
48 |
seg_model = tf.keras.models.load_model('seg_unet_model.h5', custom_objects={'Combo_loss': Combo_loss, 'dice_coef': dice_coef})
|
49 |
|
50 |
inputs = gr.inputs.Image(type="pil", label="Upload an image")
|
51 |
+
image_output = gr.outputs.Image(type="pil", label="Output Image")
|
52 |
# outputs = gr.outputs.HTML() #uncomment for single class output
|
53 |
|
54 |
|
|
|
67 |
nparr = np.frombuffer(img_bytes, np.byte)
|
68 |
pred_pil = cv2.imdecode(nparr, cv2.IMREAD_REDUCED_COLOR_8)
|
69 |
# return "UI in developing process ..."
|
70 |
+
return pred_pil
|
71 |
|
72 |
title = "<h1 style='text-align: center;'>Semantic Segmentation</h1>"
|
73 |
description = "Upload an image and get prediction mask"
|
|
|
75 |
|
76 |
gr.Interface(fn=gen_pred,
|
77 |
inputs=inputs,
|
78 |
+
outputs='image',
|
79 |
title=title,
|
80 |
examples=[["003e2c95d.jpg"], ["003b50a15.jpg"], ["003b48a9e.jpg"], ["0038cbe45.jpg"], ["00371aa92.jpg"]],
|
81 |
description=description,
|