mouseland commited on
Commit
fc03022
·
verified ·
1 Parent(s): 77e473c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -114,8 +114,9 @@ def cellpose_segment(img_input):
114
 
115
  outpix = plot_outlines(img_input, masks)
116
  overlay = plot_overlay(img_input, masks)
117
-
118
- return outpix, overlay, flows, masks
 
119
 
120
  # Gradio Interface
121
  #iface = gr.Interface(
@@ -135,12 +136,13 @@ with gr.Blocks(title = "Hello",
135
  send_btn = gr.Button("Run Cellpose-SAM")
136
 
137
  with gr.Column(scale=1):
138
- output_image1 = gr.Image(label = "Output image", type = "numpy")
139
- output_image2 = gr.Image(label = "Output image", type = "numpy")
140
- output_image3 = gr.Image(label = "Output image", type = "numpy")
141
- output_image4 = gr.Image(label = "Output image", type = "numpy")
 
142
 
143
- send_btn.click(fn=cellpose_segment, inputs=[input_image], outputs=[output_image1, output_image4, output_image2, output_image3])
144
 
145
 
146
 
 
114
 
115
  outpix = plot_outlines(img_input, masks)
116
  overlay = plot_overlay(img_input, masks)
117
+
118
+ iperm = np.random.permutation(np.max(masks.flatten()).astype('int')+1)
119
+ return outpix, overlay, flows, iperm[masks]
120
 
121
  # Gradio Interface
122
  #iface = gr.Interface(
 
136
  send_btn = gr.Button("Run Cellpose-SAM")
137
 
138
  with gr.Column(scale=1):
139
+ img_outlines = gr.Image(label = "Output image", type = "numpy")
140
+ masks = gr.Image(label = "Output image", type = "numpy")
141
+ img_overlay = gr.Image(label = "Output image", type = "numpy")
142
+ flows = gr.Image(label = "Output image", type = "numpy")
143
+
144
 
145
+ send_btn.click(fn=cellpose_segment, inputs=[input_image], outputs=[img_outlines, img_overlay, flows, masks])
146
 
147
 
148