yuragoithf commited on
Commit
fe2a940
·
1 Parent(s): 071957e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -53,7 +53,7 @@ def dice_coef(y_true, y_pred, smooth=1):
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
 
59
 
@@ -73,9 +73,6 @@ def gen_pred(img=inputs, model=seg_model):
73
  img_bytes = pred.tobytes()
74
  nparr = np.frombuffer(img_bytes, np.byte)
75
  pred_pil = cv2.imdecode(nparr, cv2.IMREAD_REDUCED_COLOR_8)
76
- # color_coverted = cv2.cvtColor(pred, cv2.COLOR_BGR2RGB)
77
- # pil_image = Image.fromarray(pred)
78
- # PIL_image = Image.fromarray(pred.astype('uint8'), 'RGB')
79
  # return "UI in developing process ..."
80
  return pred_pil
81
 
@@ -85,7 +82,7 @@ description = "Upload an image and get prediction mask"
85
 
86
  gr.Interface(fn=gen_pred,
87
  inputs=inputs,
88
- outputs="image",
89
  title=title,
90
  examples=[["003e2c95d.jpg"], ["003b50a15.jpg"], ["003b48a9e.jpg"], ["0038cbe45.jpg"], ["00371aa92.jpg"]],
91
  # css=css_code,
 
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="pil", label="Output Image")
57
  # outputs = gr.outputs.HTML() #uncomment for single class output
58
 
59
 
 
73
  img_bytes = pred.tobytes()
74
  nparr = np.frombuffer(img_bytes, np.byte)
75
  pred_pil = cv2.imdecode(nparr, cv2.IMREAD_REDUCED_COLOR_8)
 
 
 
76
  # return "UI in developing process ..."
77
  return pred_pil
78
 
 
82
 
83
  gr.Interface(fn=gen_pred,
84
  inputs=inputs,
85
+ outputs=image_output,
86
  title=title,
87
  examples=[["003e2c95d.jpg"], ["003b50a15.jpg"], ["003b48a9e.jpg"], ["0038cbe45.jpg"], ["00371aa92.jpg"]],
88
  # css=css_code,