Update app.py
Browse files
app.py
CHANGED
|
@@ -132,10 +132,10 @@ def cellpose_segment(img_input):
|
|
| 132 |
#flows = Image.fromarray(flows)
|
| 133 |
#masks = Image.fromarray(255. * crand[masks])
|
| 134 |
|
| 135 |
-
pil_masks = Image.fromarray(masks.astype('
|
| 136 |
pil_masks.save("test.png")
|
| 137 |
|
| 138 |
-
return outpix, overlay, flows,
|
| 139 |
|
| 140 |
# Gradio Interface
|
| 141 |
#iface = gr.Interface(
|
|
@@ -165,7 +165,7 @@ with gr.Blocks(title = "Hello",
|
|
| 165 |
masks = gr.Image(label = "Output image", type = "numpy")
|
| 166 |
|
| 167 |
|
| 168 |
-
send_btn.click(fn=cellpose_segment, inputs=[input_image], outputs=[img_outlines, img_overlay, flows,
|
| 169 |
|
| 170 |
down_btn.click(download_file, None, down_btn)
|
| 171 |
|
|
|
|
| 132 |
#flows = Image.fromarray(flows)
|
| 133 |
#masks = Image.fromarray(255. * crand[masks])
|
| 134 |
|
| 135 |
+
pil_masks = Image.fromarray((masks/masks.max()).astype('float32'))
|
| 136 |
pil_masks.save("test.png")
|
| 137 |
|
| 138 |
+
return outpix, overlay, flows, gr.DownloadButton(visible=True, value = "test.png")
|
| 139 |
|
| 140 |
# Gradio Interface
|
| 141 |
#iface = gr.Interface(
|
|
|
|
| 165 |
masks = gr.Image(label = "Output image", type = "numpy")
|
| 166 |
|
| 167 |
|
| 168 |
+
send_btn.click(fn=cellpose_segment, inputs=[input_image], outputs=[img_outlines, img_overlay, flows, down_btn])
|
| 169 |
|
| 170 |
down_btn.click(download_file, None, down_btn)
|
| 171 |
|