Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -188,6 +188,8 @@ def do_prediction(model_name, img):
|
|
| 188 |
|
| 189 |
img_h_page = img.shape[0]
|
| 190 |
img_w_page = img.shape[1]
|
|
|
|
|
|
|
| 191 |
img = img / float(255.0)
|
| 192 |
img = resize_image(img, img_height_model, img_width_model)
|
| 193 |
|
|
@@ -203,7 +205,8 @@ def do_prediction(model_name, img):
|
|
| 203 |
_, thresh = cv2.threshold(imgray, 0, 255, 0)
|
| 204 |
#thresh = cv2.dilate(thresh, KERNEL, iterations=3)
|
| 205 |
contours, _ = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
|
| 206 |
-
|
|
|
|
| 207 |
if len(contours)>0:
|
| 208 |
cnt_size = np.array([cv2.contourArea(contours[j]) for j in range(len(contours))])
|
| 209 |
cnt = contours[np.argmax(cnt_size)]
|
|
|
|
| 188 |
|
| 189 |
img_h_page = img.shape[0]
|
| 190 |
img_w_page = img.shape[1]
|
| 191 |
+
|
| 192 |
+
print(img.shape, img_h_page,img_w_page)
|
| 193 |
img = img / float(255.0)
|
| 194 |
img = resize_image(img, img_height_model, img_width_model)
|
| 195 |
|
|
|
|
| 205 |
_, thresh = cv2.threshold(imgray, 0, 255, 0)
|
| 206 |
#thresh = cv2.dilate(thresh, KERNEL, iterations=3)
|
| 207 |
contours, _ = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
|
| 208 |
+
|
| 209 |
+
print(len(contours),'ggg')
|
| 210 |
if len(contours)>0:
|
| 211 |
cnt_size = np.array([cv2.contourArea(contours[j]) for j in range(len(contours))])
|
| 212 |
cnt = contours[np.argmax(cnt_size)]
|