yuragoithf commited on
Commit
56df16f
·
1 Parent(s): 7b635eb

Update app.py

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