You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Working setup : Python PDF extraction, with models downloaded offline & path set via artifacts_path. Works perfectly & extracts 35 sections from PDF document.
Same setup deploy on Azure function app (it cant connect to public network), works but extracts only one section from PDF.
Why ?
Code :
ap = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(file))), "docling_models")
pipeline_options = PdfPipelineOptions(artifacts_path = ap)
def extract_text_from_bytes(file_bytes: bytes, filename: str = "document") -> str:
"""
Extract text from byte object using Docling.
Args:
file_bytes: Byte content of the document
filename: Optional filename for context (helps with format detection)
Returns:
Extracted text in markdown format
"""
file_like_object = io.BytesIO(file_bytes)
source = DocumentStream(name = filename, stream=file_like_object)
converter = DocumentConverter(format_options={InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)})
result = converter.convert(source)
md = result.document.export_to_markdown()
#logger.info(f"Text extracted from {filename}: {md}")
return md
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Working setup : Python PDF extraction, with models downloaded offline & path set via artifacts_path. Works perfectly & extracts 35 sections from PDF document.
Same setup deploy on Azure function app (it cant connect to public network), works but extracts only one section from PDF.
Why ?
Code :
ap = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(file))), "docling_models")
pipeline_options = PdfPipelineOptions(artifacts_path = ap)
def extract_text_from_bytes(file_bytes: bytes, filename: str = "document") -> str:
"""
Extract text from byte object using Docling.
Beta Was this translation helpful? Give feedback.
All reactions