Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -76,7 +76,7 @@ def return_num_columns(img):
|
|
76 |
return num_col
|
77 |
|
78 |
def return_scaled_image(img, num_col, width_early, model_name):
|
79 |
-
|
80 |
if num_col == 1 and width_early < 1100:
|
81 |
img_w_new = 2000
|
82 |
img_h_new = int(img.shape[0] / float(img.shape[1]) * 2000)
|
@@ -129,7 +129,7 @@ def return_scaled_image(img, num_col, width_early, model_name):
|
|
129 |
img_w_new = width_early
|
130 |
img_h_new = int(img.shape[0] / float(img.shape[1]) * width_early)
|
131 |
img_new = resize_image(img, img_h_new, img_w_new)
|
132 |
-
|
133 |
if num_col == 1:
|
134 |
img_w_new = 1000
|
135 |
img_h_new = int(img_org.shape[0] / float(img_org.shape[1]) * img_w_new)
|
@@ -153,8 +153,8 @@ def return_scaled_image(img, num_col, width_early, model_name):
|
|
153 |
img_h_new = int(img_org.shape[0] / float(img_org.shape[1]) * img_w_new)
|
154 |
img_resized = resize_image(img,img_h_new, img_w_new )
|
155 |
|
156 |
-
|
157 |
-
return
|
158 |
|
159 |
def do_prediction(model_name, img):
|
160 |
img_org = np.copy(img)
|
|
|
76 |
return num_col
|
77 |
|
78 |
def return_scaled_image(img, num_col, width_early, model_name):
|
79 |
+
if model_name== ("SBB/eynollah-main-regions-aug-rotation" | "SBB/eynollah-main-regions-aug-scaling" | "SBB/eynollah-main-regions-ensembled"):
|
80 |
if num_col == 1 and width_early < 1100:
|
81 |
img_w_new = 2000
|
82 |
img_h_new = int(img.shape[0] / float(img.shape[1]) * 2000)
|
|
|
129 |
img_w_new = width_early
|
130 |
img_h_new = int(img.shape[0] / float(img.shape[1]) * width_early)
|
131 |
img_new = resize_image(img, img_h_new, img_w_new)
|
132 |
+
elif model_name=="SBB/eynollah-main-regions":
|
133 |
if num_col == 1:
|
134 |
img_w_new = 1000
|
135 |
img_h_new = int(img_org.shape[0] / float(img_org.shape[1]) * img_w_new)
|
|
|
153 |
img_h_new = int(img_org.shape[0] / float(img_org.shape[1]) * img_w_new)
|
154 |
img_resized = resize_image(img,img_h_new, img_w_new )
|
155 |
|
156 |
+
img_new = otsu_copy_binary(img_resized)
|
157 |
+
return img_new
|
158 |
|
159 |
def do_prediction(model_name, img):
|
160 |
img_org = np.copy(img)
|