ReyaLabColumbia commited on
Commit
5d8e2f8
·
verified ·
1 Parent(s): 61c41cf

Upload Colony_Analyzer_AI2_HF.py

Browse files
Files changed (1) hide show
  1. Colony_Analyzer_AI2_HF.py +4 -1
Colony_Analyzer_AI2_HF.py CHANGED
@@ -40,7 +40,10 @@ 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
- width, height = img.size
 
 
 
44
  i_num = height // patch_size
45
  j_num = width // patch_size
46
  count = 1
 
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