ocr-stream 2.2__tar.gz → 2.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ocr_stream
3
- Version: 2.2
3
+ Version: 2.2.6
4
4
  Summary: Extrair textos de documentos digitalizados e imagens.
5
5
  Author: Bruno Chaves
6
6
  Requires-Python: >=3.11
@@ -84,7 +84,8 @@ class RecognizePdf(object):
84
84
  return text_recognized.to_document()
85
85
 
86
86
  def recognize_document(self, doc: DocumentPdf) -> DocumentPdf:
87
- _stream = PdfStream()
87
+ _pages: list[PageDocumentPdf] = []
88
+ _pages.clear()
88
89
  _conv = ConvertPdfToImages.create(doc)
89
90
  images: list[ImageObject] = _conv.to_images()
90
91
  max_num: int = len(images)
@@ -94,12 +95,15 @@ class RecognizePdf(object):
94
95
  f'Aplicando OCR [{num+1} de {max_num}]'
95
96
  )
96
97
  text_recognized = self.recognize_image.image_recognize(img)
97
- _stream.add_page(text_recognized.to_page_pdf())
98
+ _pages.append(text_recognized.to_page_pdf())
98
99
  print()
99
100
  self.pbar.stop()
100
- return _stream.to_document()
101
+ new_doc = DocumentPdf.create_from_pages(_pages)
102
+ return new_doc
101
103
 
102
104
  def recognize_file_pdf(self, file: File) -> DocumentPdf:
103
- _doc = DocumentPdf.create_from_file(file)
104
- return self.recognize_document(_doc)
105
+ file_doc = DocumentPdf.create_from_file(file)
106
+ recognized_doc = self.recognize_document(file_doc)
107
+ del file_doc
108
+ return recognized_doc
105
109
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ocr_stream
3
- Version: 2.2
3
+ Version: 2.2.6
4
4
  Summary: Extrair textos de documentos digitalizados e imagens.
5
5
  Author: Bruno Chaves
6
6
  Requires-Python: >=3.11
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ocr_stream"
7
- version = "2.2"
7
+ version = "2.2.6"
8
8
  authors = [
9
9
  { name="Bruno Chaves"},
10
10
  ]
File without changes
File without changes