Update app.py
Browse files
app.py
CHANGED
@@ -60,10 +60,12 @@ def predict(filepath):
|
|
60 |
max_y = max(tl[1], tr[1], br[1], bl[1])
|
61 |
max_y = min(height-1, max_y)
|
62 |
# crop the region of interest (ROI)
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
67 |
texts = texts + '\t' + out
|
68 |
|
69 |
return texts
|
|
|
60 |
max_y = max(tl[1], tr[1], br[1], bl[1])
|
61 |
max_y = min(height-1, max_y)
|
62 |
# crop the region of interest (ROI)
|
63 |
+
try:
|
64 |
+
cropped_image = inp[min_y:max_y,min_x:max_x,:] # crop the image
|
65 |
+
cropped_image = Image.fromarray(cropped_image)
|
66 |
+
out = viet_ocr_predict(cropped_image)
|
67 |
+
catch:
|
68 |
+
out = text
|
69 |
texts = texts + '\t' + out
|
70 |
|
71 |
return texts
|