Update app.py
Browse files
app.py
CHANGED
|
@@ -147,7 +147,11 @@ def cellpose_segment(img_input):
|
|
| 147 |
# description="upload an image, then cellpose will segment it at a max size of 400x400 (for full functionality, 'pip install cellpose' locally)"
|
| 148 |
#)
|
| 149 |
|
| 150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
with gr.Blocks(title = "Hello",
|
| 152 |
css=".gradio-container {background:purple;}") as demo:
|
| 153 |
|
|
@@ -155,8 +159,10 @@ with gr.Blocks(title = "Hello",
|
|
| 155 |
with gr.Column(scale=1):
|
| 156 |
input_image = gr.Image(label = "Input image", type = "numpy")
|
| 157 |
send_btn = gr.Button("Run Cellpose-SAM")
|
| 158 |
-
|
| 159 |
-
|
|
|
|
|
|
|
| 160 |
|
| 161 |
with gr.Column(scale=1):
|
| 162 |
img_outlines = gr.Image(label = "Output image", type = "pil")
|
|
@@ -167,7 +173,7 @@ with gr.Blocks(title = "Hello",
|
|
| 167 |
|
| 168 |
send_btn.click(fn=cellpose_segment, inputs=[input_image], outputs=[img_outlines, img_overlay, flows, down_btn, down_btn2])
|
| 169 |
|
| 170 |
-
down_btn.click(
|
| 171 |
|
| 172 |
|
| 173 |
|
|
|
|
| 147 |
# description="upload an image, then cellpose will segment it at a max size of 400x400 (for full functionality, 'pip install cellpose' locally)"
|
| 148 |
#)
|
| 149 |
|
| 150 |
+
def download_function:
|
| 151 |
+
b1 = gr.DownloadButton("Download masks as TIFF", visible=False)
|
| 152 |
+
b2 = gr.DownloadButton("Download outline image as PNG", visible=False)
|
| 153 |
+
return b1, b2
|
| 154 |
+
|
| 155 |
with gr.Blocks(title = "Hello",
|
| 156 |
css=".gradio-container {background:purple;}") as demo:
|
| 157 |
|
|
|
|
| 159 |
with gr.Column(scale=1):
|
| 160 |
input_image = gr.Image(label = "Input image", type = "numpy")
|
| 161 |
send_btn = gr.Button("Run Cellpose-SAM")
|
| 162 |
+
with gr.Column(scale=1):
|
| 163 |
+
down_btn = gr.DownloadButton("Download masks as TIFF", visible=False)
|
| 164 |
+
with gr.Column(scale=1):
|
| 165 |
+
down_btn2 = gr.DownloadButton("Download outline image as PNG", visible=False)
|
| 166 |
|
| 167 |
with gr.Column(scale=1):
|
| 168 |
img_outlines = gr.Image(label = "Output image", type = "pil")
|
|
|
|
| 173 |
|
| 174 |
send_btn.click(fn=cellpose_segment, inputs=[input_image], outputs=[img_outlines, img_overlay, flows, down_btn, down_btn2])
|
| 175 |
|
| 176 |
+
#down_btn.click(download_function, None, [down_btn, down_btn2])
|
| 177 |
|
| 178 |
|
| 179 |
|