diff --git a/nlp/ocr.py b/nlp/ocr.py index c4596b2..03ec27e 100644 --- a/nlp/ocr.py +++ b/nlp/ocr.py @@ -9,10 +9,10 @@ reader = easyocr.Reader(['ru']) # Specify the languages you want to support def ocr_recognize(file_path): # Use EasyOCR to detect text in the photo result = reader.readtext(file_path) - logger.debug(result) + logger.debug("OCR Result: %s", result) - # Extract the recognized text from the result - recognized_text = ' '.join([text[0] for text in result if isinstance(text, tuple) and len(text) > 0]) + # Extract recognized text + recognized_text = ' '.join([text[1] for text in result if isinstance(text, tuple) and len(text) > 1]) - logger.debug(f'recognized_text: {recognized_text}') + logger.debug(f'Recognized Text: {recognized_text}') return recognized_text \ No newline at end of file