mouseland commited on
Commit
4c3c584
·
verified ·
1 Parent(s): 736285e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -122,7 +122,12 @@ def cellpose_segment(img_input):
122
  overlay = plot_overlay(img_input, masks)
123
 
124
  iperm = np.random.permutation(np.max(masks.flatten()).astype('int')+1)
125
- return outpix, overlay, flows, iperm[masks]
 
 
 
 
 
126
 
127
  # Gradio Interface
128
  #iface = gr.Interface(
@@ -142,10 +147,10 @@ with gr.Blocks(title = "Hello",
142
  send_btn = gr.Button("Run Cellpose-SAM")
143
 
144
  with gr.Column(scale=1):
145
- img_overlay = gr.Image(label = "Output image", type = "numpy")
146
  img_outlines = gr.Image(label = "Output image", type = "pil")
147
- flows = gr.Image(label = "Output image", type = "numpy")
148
- masks = gr.Image(label = "Output image", type = "numpy")
149
 
150
 
151
  send_btn.click(fn=cellpose_segment, inputs=[input_image], outputs=[img_outlines, img_overlay, flows, masks])
 
122
  overlay = plot_overlay(img_input, masks)
123
 
124
  iperm = np.random.permutation(np.max(masks.flatten()).astype('int')+1)
125
+
126
+ overlay = Image.fromarray(overlay)
127
+ flows = Image.fromarray(flows)
128
+ masks = Image.fromarray(iperm[masks])
129
+
130
+ return outpix, overlay, flows, masks
131
 
132
  # Gradio Interface
133
  #iface = gr.Interface(
 
147
  send_btn = gr.Button("Run Cellpose-SAM")
148
 
149
  with gr.Column(scale=1):
150
+ img_overlay = gr.Image(label = "Output image", type = "pil")
151
  img_outlines = gr.Image(label = "Output image", type = "pil")
152
+ flows = gr.Image(label = "Output image", type = "pil")
153
+ masks = gr.Image(label = "Output image", type = "pil")
154
 
155
 
156
  send_btn.click(fn=cellpose_segment, inputs=[input_image], outputs=[img_outlines, img_overlay, flows, masks])