A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Ignore error if orientation detection fails
Pit Kleyersburgc45f951ca017
diff --git a/src/documents/consumer.py b/src/documents/consumer.pyindex 12761e992..21484036b 100644--- a/src/documents/consumer.py+++ b/src/documents/consumer.py@@ -17,6 +17,7 @@ from PIL import Imagefrom django.conf import settingsfrom django.utils import timezonefrom django.template.defaultfilters import slugify+from pyocr.tesseract import TesseractErrorfrom logger.models import Logfrom paperless.db import GnuPG@@ -29,8 +30,11 @@ def image_to_string(args):self, png, lang = argswith Image.open(os.path.join(self.SCRATCH, png)) as f:if self.OCR.can_detect_orientation():- orientation = self.OCR.detect_orientation(f, lang=lang)- f = f.rotate(orientation["angle"], expand=1)+ try:+ orientation = self.OCR.detect_orientation(f, lang=lang)+ f = f.rotate(orientation["angle"], expand=1)+ except TesseractError:+ passreturn self.OCR.image_to_string(f, lang=lang)