yuragoithf commited on
Commit
e67f4f4
·
1 Parent(s): d453b08

Update app.py

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