Update app.py
Browse files
app.py
CHANGED
|
@@ -116,15 +116,31 @@ def cellpose_segment(img_input):
|
|
| 116 |
overlay = plot_overlay(img_input, masks)
|
| 117 |
masks = Image.fromarray(masks)
|
| 118 |
|
| 119 |
-
return outpix, overlay, flows, masks
|
| 120 |
|
| 121 |
# Gradio Interface
|
| 122 |
-
iface = gr.Interface(
|
| 123 |
-
fn=cellpose_segment,
|
| 124 |
-
inputs="image",
|
| 125 |
-
outputs=["image", "image", "image", "image"],
|
| 126 |
-
title="cellpose segmentation",
|
| 127 |
-
description="upload an image, then cellpose will segment it at a max size of 400x400 (for full functionality, 'pip install cellpose' locally)"
|
| 128 |
-
)
|
| 129 |
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
overlay = plot_overlay(img_input, masks)
|
| 117 |
masks = Image.fromarray(masks)
|
| 118 |
|
| 119 |
+
return masks # outpix, overlay, flows, masks
|
| 120 |
|
| 121 |
# Gradio Interface
|
| 122 |
+
#iface = gr.Interface(
|
| 123 |
+
# fn=cellpose_segment,
|
| 124 |
+
# inputs="image",
|
| 125 |
+
# outputs=["image", "image", "image", "image"],
|
| 126 |
+
# title="cellpose segmentation",
|
| 127 |
+
# description="upload an image, then cellpose will segment it at a max size of 400x400 (for full functionality, 'pip install cellpose' locally)"
|
| 128 |
+
#)
|
| 129 |
|
| 130 |
+
with gr.Blocks(title = "Hello",
|
| 131 |
+
css=".gradio-container {background:purple;}") as demo:
|
| 132 |
+
|
| 133 |
+
with gr.Row():
|
| 134 |
+
input_image = gr.Image(label = "Input image", type = "pil")
|
| 135 |
+
output_image3 = gr.Image(label = "Output image", type = "pil")
|
| 136 |
+
|
| 137 |
+
#with gr.Row():
|
| 138 |
+
# output_image2 = gr.Image(label = "Output image", type = "pil")
|
| 139 |
+
# output_image3 = gr.Image(label = "Output image", type = "pil")
|
| 140 |
+
|
| 141 |
+
send_btn = gr.Button("Infer")
|
| 142 |
+
send_btn.click(fn=infer, inputs=[model, input_image], outputs=[output_image3])
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
demo.launch()
|