hantech commited on
Commit
a9156d4
·
verified ·
1 Parent(s): 7c1d5cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
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
- cropped_image = inp[min_y:max_y,min_x:max_x,:] # crop the image
64
- cropped_image = Image.fromarray(cropped_image)
65
- out = viet_ocr_predict(cropped_image)
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