dhanushreddy29 commited on
Commit
ad04ec5
1 Parent(s): fca298c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -39,9 +39,8 @@ def predict_segmentation(img):
39
  gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
40
  resized_img = cv2.resize(gray_img, im_size)
41
  pred = learn.predict(resized_img)
42
- color_pred = pred[0].show(ctx=None, cmap='gray', alpha=None)
43
- color_pred_array = color_pred_array.astype(np.uint8)
44
- output_image = Image.fromarray(color_pred_array)
45
  # Save the image to a temporary file
46
  temp_file = 'temp.png'
47
  output_image.save(temp_file)
 
39
  gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
40
  resized_img = cv2.resize(gray_img, im_size)
41
  pred = learn.predict(resized_img)
42
+ scaled_pred = (pred[0].numpy() * 255).astype(np.uint8)
43
+ output_image = PILImage.create(scaled_pred)
 
44
  # Save the image to a temporary file
45
  temp_file = 'temp.png'
46
  output_image.save(temp_file)