Update app.py
Browse files
app.py
CHANGED
|
@@ -91,7 +91,6 @@ def plot_outlines(img, masks):
|
|
| 91 |
buf.seek(0)
|
| 92 |
pil_img = Image.open(buf)
|
| 93 |
|
| 94 |
-
pil_img = pil_img.resize((img.shape[1], img.shape[0]), resample = Image.BICUBIC)
|
| 95 |
return pil_img
|
| 96 |
|
| 97 |
def plot_overlay(img, masks):
|
|
@@ -156,6 +155,13 @@ def cellpose_segment(img_input):
|
|
| 156 |
|
| 157 |
overlay = Image.fromarray(overlay)
|
| 158 |
flows = Image.fromarray(flows)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
#masks = Image.fromarray(255. * crand[masks])
|
| 160 |
|
| 161 |
pil_masks = Image.fromarray(masks.astype('int32'))
|
|
@@ -202,9 +208,9 @@ with gr.Blocks(title = "Hello",
|
|
| 202 |
|
| 203 |
|
| 204 |
with gr.Column(scale=2):
|
| 205 |
-
img_outlines = gr.Image(label = "Outlines", type = "pil", format = 'png'
|
| 206 |
-
img_overlay = gr.Image(label = "Overlay", type = "pil", format = 'png'
|
| 207 |
-
flows = gr.Image(label = "Cellpose flows", type = "pil", format = 'png'
|
| 208 |
#masks = gr.Image(label = "Output image", type = "numpy")
|
| 209 |
|
| 210 |
|
|
|
|
| 91 |
buf.seek(0)
|
| 92 |
pil_img = Image.open(buf)
|
| 93 |
|
|
|
|
| 94 |
return pil_img
|
| 95 |
|
| 96 |
def plot_overlay(img, masks):
|
|
|
|
| 155 |
|
| 156 |
overlay = Image.fromarray(overlay)
|
| 157 |
flows = Image.fromarray(flows)
|
| 158 |
+
|
| 159 |
+
Ly, Lx = img.shape[:2]
|
| 160 |
+
c = Lx
|
| 161 |
+
outpix = outpix.resize((Lx, Ly), resample = Image.BICUBIC)
|
| 162 |
+
overlay = overlay.resize((Lx, Ly), resample = Image.BICUBIC)
|
| 163 |
+
flows = flows.resize((Lx, Ly), resample = Image.BICUBIC)
|
| 164 |
+
|
| 165 |
#masks = Image.fromarray(255. * crand[masks])
|
| 166 |
|
| 167 |
pil_masks = Image.fromarray(masks.astype('int32'))
|
|
|
|
| 208 |
|
| 209 |
|
| 210 |
with gr.Column(scale=2):
|
| 211 |
+
img_outlines = gr.Image(label = "Outlines", type = "pil", format = 'png') #, width = "50vw", height = "20vw")
|
| 212 |
+
img_overlay = gr.Image(label = "Overlay", type = "pil", format = 'png') #, width = "50vw", height = "20vw")
|
| 213 |
+
flows = gr.Image(label = "Cellpose flows", type = "pil", format = 'png') #, width = "50vw", height = "20vw")
|
| 214 |
#masks = gr.Image(label = "Output image", type = "numpy")
|
| 215 |
|
| 216 |
|