itzjunayed commited on
Commit
2028dcd
·
verified ·
1 Parent(s): edf8500

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -50,18 +50,15 @@ def predict_segmentation(image):
50
  # Create an alpha channel: 255 where there is segmentation, 0 otherwise
51
  rgba_img[:, :, 3] = np.where(predicted_img_resized > 0, 255, 0)
52
 
53
- # Convert the numpy array to an image and save it as a PNG file
54
  output_image = Image.fromarray(rgba_img)
55
- output_image_path = "segmented_output.png"
56
- output_image.save(output_image_path)
57
-
58
- return output_image_path
59
 
60
  # Gradio Interface
61
  iface = gr.Interface(
62
  fn=predict_segmentation,
63
  inputs="image",
64
- outputs="file",
65
  live=False
66
  )
67
 
 
50
  # Create an alpha channel: 255 where there is segmentation, 0 otherwise
51
  rgba_img[:, :, 3] = np.where(predicted_img_resized > 0, 255, 0)
52
 
53
+ # Convert the numpy array to an image and return it
54
  output_image = Image.fromarray(rgba_img)
55
+ return output_image
 
 
 
56
 
57
  # Gradio Interface
58
  iface = gr.Interface(
59
  fn=predict_segmentation,
60
  inputs="image",
61
+ outputs="image",
62
  live=False
63
  )
64