Commit
·
7b06bd6
1
Parent(s):
8371111
Update app.py
Browse files
app.py
CHANGED
@@ -52,8 +52,7 @@ def dice_coef(y_true, y_pred, smooth=1):
|
|
52 |
# Load the model
|
53 |
seg_model = tf.keras.models.load_model('seg_unet_model.h5', custom_objects={'Combo_loss': Combo_loss, 'dice_coef': dice_coef})
|
54 |
|
55 |
-
|
56 |
-
inputs = gr.inputs.ImageUpload()
|
57 |
image_output = gr.outputs.Image(type="numpy", label="Output Image")
|
58 |
# outputs = gr.outputs.HTML() #uncomment for single class output
|
59 |
|
@@ -67,7 +66,7 @@ def gen_pred(img=inputs, model=seg_model):
|
|
67 |
img = tf.expand_dims(img, axis=0)
|
68 |
pred = model.predict(img)
|
69 |
pred = np.squeeze(pred, axis=0)
|
70 |
-
return
|
71 |
|
72 |
|
73 |
title = "<h1 style='text-align: center;'>Semantic Segmentation</h1>"
|
@@ -76,7 +75,7 @@ description = "Upload an image and get prediction mask"
|
|
76 |
|
77 |
gr.Interface(fn=gen_pred,
|
78 |
inputs=inputs,
|
79 |
-
outputs=
|
80 |
title=title,
|
81 |
examples=[["003e2c95d.jpg"], ["003b50a15.jpg"], ["003b48a9e.jpg"], ["0038cbe45.jpg"], ["00371aa92.jpg"]],
|
82 |
# css=css_code,
|
|
|
52 |
# Load the model
|
53 |
seg_model = tf.keras.models.load_model('seg_unet_model.h5', custom_objects={'Combo_loss': Combo_loss, 'dice_coef': dice_coef})
|
54 |
|
55 |
+
inputs = gr.inputs.Image(type="pil", label="Upload an image", source="upload")
|
|
|
56 |
image_output = gr.outputs.Image(type="numpy", label="Output Image")
|
57 |
# outputs = gr.outputs.HTML() #uncomment for single class output
|
58 |
|
|
|
66 |
img = tf.expand_dims(img, axis=0)
|
67 |
pred = model.predict(img)
|
68 |
pred = np.squeeze(pred, axis=0)
|
69 |
+
return "IN PROGRESS..."
|
70 |
|
71 |
|
72 |
title = "<h1 style='text-align: center;'>Semantic Segmentation</h1>"
|
|
|
75 |
|
76 |
gr.Interface(fn=gen_pred,
|
77 |
inputs=inputs,
|
78 |
+
outputs='text',
|
79 |
title=title,
|
80 |
examples=[["003e2c95d.jpg"], ["003b50a15.jpg"], ["003b48a9e.jpg"], ["0038cbe45.jpg"], ["00371aa92.jpg"]],
|
81 |
# css=css_code,
|