ReyaLabColumbia commited on
Commit
9792aab
·
verified ·
1 Parent(s): 5d8e2f8

Upload Colony_Analyzer_AI2_HF.py

Browse files
Files changed (1) hide show
  1. Colony_Analyzer_AI2_HF.py +5 -3
Colony_Analyzer_AI2_HF.py CHANGED
@@ -40,10 +40,12 @@ def pad(img_np, tw=2048, th=1536):
40
  #this is the huggingface version
41
  def cut_img(img, patch_size=512):
42
  img_map = {}
43
- if hasattr(img, "size"):
44
- width, height = img.size # PIL Image
 
45
  else:
46
- height, width = img.shape[:2] # NumPy array
 
47
  i_num = height // patch_size
48
  j_num = width // patch_size
49
  count = 1
 
40
  #this is the huggingface version
41
  def cut_img(img, patch_size=512):
42
  img_map = {}
43
+ if isinstance(img, Image.Image):
44
+ width, height = img.size
45
+ img_np = np.array(img)
46
  else:
47
+ img_np = img
48
+ height, width = img_np.shape[:2]
49
  i_num = height // patch_size
50
  j_num = width // patch_size
51
  count = 1