mouseland commited on
Commit
8ebcd09
·
verified ·
1 Parent(s): 218cd58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
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
- resize = np.max(img.shape)
179
- if resize<1000:
180
  masks, flows = run_model_gpu(img)
181
- elif resize < 5000:
182
  masks, flows = run_model_gpu60(img)
183
- elif resize < 20000:
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)