hantech commited on
Commit
d7f20f2
β€’
1 Parent(s): b9ba911

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -9,7 +9,7 @@ import easyocr
9
  import omegaconf
10
  import cv2
11
  import json
12
- from autocorrect import Speller
13
 
14
  spell = Speller(lang='vi')
15
  from vietocr.vietocr.tool.predictor import Predictor
@@ -88,7 +88,7 @@ def inference(filepath, lang, labels):
88
  cropped_image = img[min_y:max_y,min_x:max_x] # crop the image
89
  cropped_image = Image.fromarray(cropped_image)
90
  out = recognitor.predict(cropped_image)
91
- texts = texts + '\t' + spell(out)
92
  result = query(texts, labels)
93
  jsonText = json.dumps(result)
94
  im = PIL.Image.open(filepath)
 
9
  import omegaconf
10
  import cv2
11
  import json
12
+ from iftc.spelling_corrector import acronym_correction
13
 
14
  spell = Speller(lang='vi')
15
  from vietocr.vietocr.tool.predictor import Predictor
 
88
  cropped_image = img[min_y:max_y,min_x:max_x] # crop the image
89
  cropped_image = Image.fromarray(cropped_image)
90
  out = recognitor.predict(cropped_image)
91
+ texts = texts + '\t' + acronym_correction(out)
92
  result = query(texts, labels)
93
  jsonText = json.dumps(result)
94
  im = PIL.Image.open(filepath)