yuragoithf commited on
Commit
5f088d2
·
1 Parent(s): 3e01cd2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -11,6 +11,7 @@ from PIL import Image
11
  from matplotlib import cm
12
  from tensorflow import keras
13
 
 
14
 
15
  resized_shape = (768, 768, 3)
16
  IMG_SCALING = (1, 1)
@@ -64,14 +65,14 @@ 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
- pil_img = Image.fromarray((pred * 255).astype(np.uint8))
68
  # pil_img = Image.fromarray(pred, 'RGB')
69
  # im = Image.fromarray((pred * 255).astype(np.uint8))
70
  # img_bytes = pred.tobytes()
71
  # nparr = np.frombuffer(img_bytes, np.byte)
72
  # pred_pil = cv2.imdecode(nparr, cv2.IMREAD_REDUCED_COLOR_8)
73
  # return "UI in developing process ..."
74
- return pil_img
75
 
76
  title = "<h1 style='text-align: center;'>Semantic Segmentation</h1>"
77
  description = "Upload an image and get prediction mask"
 
11
  from matplotlib import cm
12
  from tensorflow import keras
13
 
14
+ from matplotlib import cm
15
 
16
  resized_shape = (768, 768, 3)
17
  IMG_SCALING = (1, 1)
 
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
  # 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 image
76
 
77
  title = "<h1 style='text-align: center;'>Semantic Segmentation</h1>"
78
  description = "Upload an image and get prediction mask"