From 7a899a95939779a2dd44503105b16c1c379a5979 Mon Sep 17 00:00:00 2001 From: Untone Date: Sun, 29 Sep 2024 08:27:06 +0300 Subject: [PATCH] ocr-fix --- nlp/ocr.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nlp/ocr.py b/nlp/ocr.py index 435db3d..8372be7 100644 --- a/nlp/ocr.py +++ b/nlp/ocr.py @@ -11,11 +11,11 @@ def ocr_recognize(file_path): # Use EasyOCR to detect text in the photo results = reader.readtext(file_path) - for result in results: - [_coords, ocr_text, ocr_accuracy] = result - logger.debug("OCR Result: %s", ocr_text) - if ocr_accuracy.item() > 0.5: - sum_text += " " + ocr_text + result = result[-1] + [_coords, ocr_text, ocr_accuracy] = result + logger.debug("OCR Result: %s", ocr_text) + if ocr_accuracy.item() > 0.5: + sum_text += " " + ocr_text logger.debug(f'Recognized Text: {sum_text}')