Update app.py
Browse files
app.py
CHANGED
|
@@ -99,6 +99,10 @@ def image_resize(img, resize=400):
|
|
| 99 |
return img
|
| 100 |
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
#@spaces.GPU(duration=10)
|
| 103 |
#def run_model_gpu(model, img):
|
| 104 |
# masks, flows, _ = model.eval(img, channels=[0,0])
|
|
@@ -126,7 +130,8 @@ def cellpose_segment(img_input):
|
|
| 126 |
|
| 127 |
overlay = Image.fromarray(overlay)
|
| 128 |
flows = Image.fromarray(flows)
|
| 129 |
-
|
|
|
|
| 130 |
|
| 131 |
return outpix, overlay, flows, masks
|
| 132 |
|
|
@@ -148,8 +153,8 @@ with gr.Blocks(title = "Hello",
|
|
| 148 |
send_btn = gr.Button("Run Cellpose-SAM")
|
| 149 |
|
| 150 |
with gr.Column(scale=1):
|
| 151 |
-
img_overlay = gr.Image(label = "Output image", type = "pil")
|
| 152 |
img_outlines = gr.Image(label = "Output image", type = "pil")
|
|
|
|
| 153 |
flows = gr.Image(label = "Output image", type = "pil")
|
| 154 |
masks = gr.Image(label = "Output image", type = "pil")
|
| 155 |
|
|
|
|
| 99 |
return img
|
| 100 |
|
| 101 |
|
| 102 |
+
def plot_masks(masks):
|
| 103 |
+
|
| 104 |
+
return RGB
|
| 105 |
+
|
| 106 |
#@spaces.GPU(duration=10)
|
| 107 |
#def run_model_gpu(model, img):
|
| 108 |
# masks, flows, _ = model.eval(img, channels=[0,0])
|
|
|
|
| 130 |
|
| 131 |
overlay = Image.fromarray(overlay)
|
| 132 |
flows = Image.fromarray(flows)
|
| 133 |
+
|
| 134 |
+
masks = Image.fromarray(255. * crand[masks])
|
| 135 |
|
| 136 |
return outpix, overlay, flows, masks
|
| 137 |
|
|
|
|
| 153 |
send_btn = gr.Button("Run Cellpose-SAM")
|
| 154 |
|
| 155 |
with gr.Column(scale=1):
|
|
|
|
| 156 |
img_outlines = gr.Image(label = "Output image", type = "pil")
|
| 157 |
+
img_overlay = gr.Image(label = "Output image", type = "pil")
|
| 158 |
flows = gr.Image(label = "Output image", type = "pil")
|
| 159 |
masks = gr.Image(label = "Output image", type = "pil")
|
| 160 |
|