Fix test_parser_with_table

This commit is contained in:
Philippe Prados 2025-02-27 11:04:34 +01:00
parent 29605cf0fc
commit 2a77d93a39

View File

@ -1557,11 +1557,13 @@ class PDFPlumberParser(BaseBlobParser):
if self.images_parser: if self.images_parser:
try: try:
from PIL import Image as Img from PIL import Image as Img
Img.fromarray(content) # Check if image is valid
Img.fromarray(content) # Check if image is valid
image_bytes = io.BytesIO() image_bytes = io.BytesIO()
numpy.save(image_bytes, content) numpy.save(image_bytes, content)
blob = Blob.from_data( blob = Blob.from_data(
image_bytes.getvalue(), mime_type="application/x-npy" image_bytes.getvalue(),
mime_type="application/x-npy",
) )
text_from_image = next( text_from_image = next(
self.images_parser.lazy_parse(blob) # type: ignore self.images_parser.lazy_parse(blob) # type: ignore