Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ import easyocr
|
|
9 |
import omegaconf
|
10 |
import cv2
|
11 |
import json
|
12 |
-
from
|
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' +
|
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)
|