yuragoithf commited on
Commit
4b7b314
·
1 Parent(s): 40dced2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -64,19 +64,19 @@ 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
- pred = np.squeeze(pred, axis=0)
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 im_PIL
80
 
81
  title = "<h1 style='text-align: center;'>Semantic Segmentation</h1>"
82
  description = "Upload an image and get prediction mask"
 
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
  # 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
 
81
  title = "<h1 style='text-align: center;'>Semantic Segmentation</h1>"
82
  description = "Upload an image and get prediction mask"