hantech commited on
Commit
adaeb1b
Β·
1 Parent(s): 813e9ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -9,7 +9,9 @@ import easyocr
9
  import omegaconf
10
  import cv2
11
  import json
 
12
 
 
13
  from vietocr.vietocr.tool.predictor import Predictor
14
  from vietocr.vietocr.tool.config import Cfg
15
 
@@ -86,7 +88,7 @@ def inference(filepath, lang, labels):
86
  cropped_image = img[min_y:max_y,min_x:max_x] # crop the image
87
  cropped_image = Image.fromarray(cropped_image)
88
  out = recognitor.predict(cropped_image)
89
- texts = texts + '\t' + out
90
  result = query(texts, labels)
91
  jsonText = json.dumps(result)
92
  im = PIL.Image.open(filepath)
 
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
16
  from vietocr.vietocr.tool.config import Cfg
17
 
 
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)