normalized-log-fix9

This commit is contained in:
Untone 2024-09-28 11:23:10 +03:00
parent 9fc576bd61
commit 494cc5766f

View File

@ -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