Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Upload Colony_Analyzer_AI2_HF.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
| 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
|