hyo37009 commited on
Commit
8740c76
·
1 Parent(s): 485c5ce
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -59,10 +59,13 @@ def greet(input_img):
59
  for label, color in enumerate(colormap):
60
  color_seg[seg.numpy() == label, :] = color
61
 
 
62
  color_seg_resized = tf.image.resize(color_seg, (input_img.shape[0], input_img.shape[1]))
63
 
64
  pred_img = np.array(input_img) * 0.5 + color_seg_resized * 0.5
65
- pred_img = pred_img.astype(np.uint8)
 
 
66
 
67
  fig = draw_plot(pred_img, seg)
68
  return fig
 
59
  for label, color in enumerate(colormap):
60
  color_seg[seg.numpy() == label, :] = color
61
 
62
+ # Resize color_seg to match the shape of input_img
63
  color_seg_resized = tf.image.resize(color_seg, (input_img.shape[0], input_img.shape[1]))
64
 
65
  pred_img = np.array(input_img) * 0.5 + color_seg_resized * 0.5
66
+
67
+ # Convert pred_img to NumPy array and then change data type
68
+ pred_img = np.array(pred_img).astype(np.uint8)
69
 
70
  fig = draw_plot(pred_img, seg)
71
  return fig