Skip to content

Commit

Permalink
fix: [ocr] fix ocr supported languages
Browse files Browse the repository at this point in the history
  • Loading branch information
Terrtia committed Apr 26, 2024
1 parent 1d1671c commit 5503d81
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bin/modules/OcrExtractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


# Default to eng
def get_model_languages(obj, ocr_languages, add_en=True):
def get_model_languages(obj, add_en=True):
if add_en:
model_languages = {'en'}
else:
Expand Down Expand Up @@ -54,8 +54,6 @@ def get_model_languages(obj, ocr_languages, add_en=True):
model_languages.add(lang)
return model_languages

model_languages = Ocrs.sanityze_ocr_languages(model_languages, ocr_languages=ocr_languages)

return model_languages

# TODO thread
Expand Down Expand Up @@ -100,7 +98,8 @@ def compute(self, message):

if not ocr.exists():
path = image.get_filepath()
languages = get_model_languages(image, self.ocr_languages)
languages = get_model_languages(image)
languages = Ocrs.sanityze_ocr_languages(languages, ocr_languages=self.ocr_languages)
print(image.id, languages)
texts = Ocrs.extract_text(path, languages)
if texts:
Expand Down

0 comments on commit 5503d81

Please sign in to comment.