Update app.py
Browse files
app.py
CHANGED
|
@@ -175,12 +175,12 @@ def cellpose_segment(filepath, resize = 1000):
|
|
| 175 |
#img_input = np.array(img_pil)
|
| 176 |
img = image_resize(img_input, resize = resize)
|
| 177 |
|
| 178 |
-
|
| 179 |
-
if
|
| 180 |
masks, flows = run_model_gpu(img)
|
| 181 |
-
elif
|
| 182 |
masks, flows = run_model_gpu60(img)
|
| 183 |
-
elif
|
| 184 |
masks, flows = run_model_gpu240(img)
|
| 185 |
else:
|
| 186 |
raise ValueError("Image size must be less than 20,000")
|
|
@@ -213,7 +213,6 @@ def cellpose_segment(filepath, resize = 1000):
|
|
| 213 |
flows = Image.fromarray(flows)
|
| 214 |
|
| 215 |
Ly, Lx = img.shape[:2]
|
| 216 |
-
c = Lx
|
| 217 |
outpix = outpix.resize((Lx, Ly), resample = Image.BICUBIC)
|
| 218 |
#overlay = overlay.resize((Lx, Ly), resample = Image.BICUBIC)
|
| 219 |
flows = flows.resize((Lx, Ly), resample = Image.BICUBIC)
|
|
|
|
| 175 |
#img_input = np.array(img_pil)
|
| 176 |
img = image_resize(img_input, resize = resize)
|
| 177 |
|
| 178 |
+
maxsize = np.max(img.shape)
|
| 179 |
+
if maxsize<1000:
|
| 180 |
masks, flows = run_model_gpu(img)
|
| 181 |
+
elif maxsize < 5000:
|
| 182 |
masks, flows = run_model_gpu60(img)
|
| 183 |
+
elif maxsize < 20000:
|
| 184 |
masks, flows = run_model_gpu240(img)
|
| 185 |
else:
|
| 186 |
raise ValueError("Image size must be less than 20,000")
|
|
|
|
| 213 |
flows = Image.fromarray(flows)
|
| 214 |
|
| 215 |
Ly, Lx = img.shape[:2]
|
|
|
|
| 216 |
outpix = outpix.resize((Lx, Ly), resample = Image.BICUBIC)
|
| 217 |
#overlay = overlay.resize((Lx, Ly), resample = Image.BICUBIC)
|
| 218 |
flows = flows.resize((Lx, Ly), resample = Image.BICUBIC)
|