Update app.py
Browse files165 unmodified lines1661671681691701711 unmodified line1731741751761771781798 unmodified lines188189190191192193194165 unmodified linesmasks, flows, _ = model.eval(img, niter = max_iter)#, channels = [0,0])return masks, flowsfrom zipfile import ZipFiledef cellpose_segment(filepath, resize = 1000,max_iter = 250):1 unmodified line#zip_path = 'masks.zip'with ZipFile(zip_path, 'w') as myzip:for j in range((len(filepath))):print(filepath[j])img_input = imread(filepath[j])#img_input = np.array(img_pil)img = image_resize(img_input, resize = resize)8 unmodified lineselse:raise ValueError("Image size must be less than 20,000")print(masks.max())target_size = (img_input.shape[1], img_input.shape[0])if (target_size[0]!=img.shape[1] or target_size[1]!=img.shape[0]):# scale it back to keep the orignal size165 unmodified lines1661671681691701711721 unmodified line1741751761771781791801811828 unmodified lines191192193194195196197198165 unmodified linesmasks, flows, _ = model.eval(img, niter = max_iter)#, channels = [0,0])return masks, flowsimport datetimefrom zipfile import ZipFiledef cellpose_segment(filepath, resize = 1000,max_iter = 250):1 unmodified line#zip_path = 'masks.zip'with ZipFile(zip_path, 'w') as myzip:for j in range((len(filepath))):now = datetime.datetime.now()formatted_now = now.strftime("%Y-%m-%d %H:%M:%S")img_input = imread(filepath[j])#img_input = np.array(img_pil)img = image_resize(img_input, resize = resize)8 unmodified lineselse:raise ValueError("Image size must be less than 20,000")print(formatted_now, j, masks.max(), os.path.split(filepath[j])[-1]))target_size = (img_input.shape[1], img_input.shape[0])if (target_size[0]!=img.shape[1] or target_size[1]!=img.shape[0]):# scale it back to keep the orignal size
app.py+6-2