mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-30 14:04:27 +00:00
updated the pyproject (still need to run poetry lock after docling-parse is accepted)
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
This commit is contained in:
parent
b8d2286dd1
commit
b8796e6705
@ -26,9 +26,9 @@ class DoclingParseV2PageBackend(PdfPageBackend):
|
||||
self._ppage = page_obj
|
||||
parsed_page = parser.parse_pdf_from_key_on_page(document_hash, page_no)
|
||||
|
||||
self.valid = "pages" in parsed_page
|
||||
self.valid = "pages" in parsed_page and len(parsed_page["pages"])==1
|
||||
if self.valid:
|
||||
self._dpage = parsed_page["pages"][page_no]
|
||||
self._dpage = parsed_page["pages"][0]
|
||||
else:
|
||||
_log.info(
|
||||
f"An error occured when loading page {page_no} of document {document_hash}."
|
||||
@ -223,8 +223,16 @@ class DoclingParseV2DocumentBackend(PdfDocumentBackend):
|
||||
)
|
||||
|
||||
def page_count(self) -> int:
|
||||
return len(self._pdoc) # To be replaced with docling-parse API
|
||||
#return len(self._pdoc) # To be replaced with docling-parse API
|
||||
|
||||
len_1 = len(self._pdoc)
|
||||
len_2 = self.parser.number_of_pages(self.document_hash)
|
||||
|
||||
if len_1!=len_2:
|
||||
_log.error(f"Inconsistent number of pages: {len_1}!={len_2}")
|
||||
|
||||
return len_2
|
||||
|
||||
def load_page(self, page_no: int) -> DoclingParseV2PageBackend:
|
||||
return DoclingParseV2PageBackend(
|
||||
self.parser, self.document_hash, page_no, self._pdoc[page_no]
|
||||
|
@ -47,7 +47,7 @@ huggingface_hub = ">=0.23,<1"
|
||||
requests = "^2.32.3"
|
||||
easyocr = "^1.7"
|
||||
tesserocr = { version = "^2.7.1", optional = true }
|
||||
docling-parse = "^1.6.0"
|
||||
docling-parse = "^2.0.0"
|
||||
certifi = ">=2024.7.4"
|
||||
rtree = "^1.3.0"
|
||||
scipy = "^1.14.1"
|
||||
|
Loading…
Reference in New Issue
Block a user