mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-27 04:24:45 +00:00
make the example files location more generic
Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
This commit is contained in:
parent
4378be1480
commit
d5d42ed4ed
@ -122,10 +122,10 @@ def main():
|
|||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
input_doc_paths = [
|
input_doc_paths = [
|
||||||
Path("../../tests/data/pdf/2206.01062.pdf"),
|
Path(__file__) / "../../tests/data/pdf/2206.01062.pdf",
|
||||||
Path("../../tests/data/pdf/2203.01017v2.pdf"),
|
Path(__file__) / "../../tests/data/pdf/2203.01017v2.pdf",
|
||||||
Path("../../tests/data/pdf/2305.03393v1.pdf"),
|
Path(__file__) / "../../tests/data/pdf/2305.03393v1.pdf",
|
||||||
Path("../../tests/data/pdf/redp5110_sampled.pdf"),
|
Path(__file__) / "../../tests/data/pdf/redp5110_sampled.pdf",
|
||||||
]
|
]
|
||||||
|
|
||||||
# buf = BytesIO(Path("./test/data/2206.01062.pdf").open("rb").read())
|
# buf = BytesIO(Path("./test/data/2206.01062.pdf").open("rb").read())
|
||||||
|
@ -17,7 +17,7 @@ _log = logging.getLogger(__name__)
|
|||||||
def main():
|
def main():
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
input_doc_path = Path("../../tests/data/pdf/2206.01062.pdf")
|
input_doc_path = Path(__file__) / "../../tests/data/pdf/2206.01062.pdf"
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class ExampleFormulaUnderstandingPipeline(StandardPdfPipeline):
|
|||||||
def main():
|
def main():
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
input_doc_path = Path("../../tests/data/pdf/2203.01017v2.pdf")
|
input_doc_path = Path(__file__) / "../../tests/data/pdf/2203.01017v2.pdf"
|
||||||
|
|
||||||
pipeline_options = ExampleFormulaUnderstandingPipelineOptions()
|
pipeline_options = ExampleFormulaUnderstandingPipelineOptions()
|
||||||
pipeline_options.do_formula_understanding = True
|
pipeline_options.do_formula_understanding = True
|
||||||
|
@ -76,7 +76,7 @@ class ExamplePictureClassifierPipeline(StandardPdfPipeline):
|
|||||||
def main():
|
def main():
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
input_doc_path = Path("../../tests/data/pdf/2206.01062.pdf")
|
input_doc_path = Path(__file__) / "../../tests/data/pdf/2206.01062.pdf"
|
||||||
|
|
||||||
pipeline_options = ExamplePictureClassifierPipelineOptions()
|
pipeline_options = ExamplePictureClassifierPipelineOptions()
|
||||||
pipeline_options.images_scale = 2.0
|
pipeline_options.images_scale = 2.0
|
||||||
|
@ -16,7 +16,7 @@ IMAGE_RESOLUTION_SCALE = 2.0
|
|||||||
def main():
|
def main():
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
input_doc_path = Path("../../tests/data/pdf/2206.01062.pdf")
|
input_doc_path = Path(__file__) / "../../tests/data/pdf/2206.01062.pdf"
|
||||||
output_dir = Path("scratch")
|
output_dir = Path("scratch")
|
||||||
|
|
||||||
# Important: For operating with page images, we must keep them, otherwise the DocumentConverter
|
# Important: For operating with page images, we must keep them, otherwise the DocumentConverter
|
||||||
|
@ -19,7 +19,7 @@ IMAGE_RESOLUTION_SCALE = 2.0
|
|||||||
def main():
|
def main():
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
input_doc_path = Path("../../tests/data/pdf/2206.01062.pdf")
|
input_doc_path = Path(__file__) / "../../tests/data/pdf/2206.01062.pdf"
|
||||||
output_dir = Path("scratch")
|
output_dir = Path("scratch")
|
||||||
|
|
||||||
# Important: For operating with page images, we must keep them, otherwise the DocumentConverter
|
# Important: For operating with page images, we must keep them, otherwise the DocumentConverter
|
||||||
|
@ -12,7 +12,7 @@ _log = logging.getLogger(__name__)
|
|||||||
def main():
|
def main():
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
input_doc_path = Path("../../tests/data/pdf/2206.01062.pdf")
|
input_doc_path = Path(__file__) / "../../tests/data/pdf/2206.01062.pdf"
|
||||||
output_dir = Path("scratch")
|
output_dir = Path("scratch")
|
||||||
|
|
||||||
doc_converter = DocumentConverter()
|
doc_converter = DocumentConverter()
|
||||||
|
@ -9,7 +9,7 @@ from docling.document_converter import DocumentConverter, PdfFormatOption
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
input_doc = Path("../../tests/data/pdf/2206.01062.pdf")
|
input_doc = Path(__file__) / "../../tests/data/pdf/2206.01062.pdf"
|
||||||
|
|
||||||
pipeline_options = PdfPipelineOptions()
|
pipeline_options = PdfPipelineOptions()
|
||||||
pipeline_options.do_ocr = True
|
pipeline_options.do_ocr = True
|
||||||
|
@ -67,7 +67,7 @@ def watsonx_vlm_options():
|
|||||||
def main():
|
def main():
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
input_doc_path = Path("../../tests/data/pdf/2206.01062.pdf")
|
input_doc_path = Path(__file__) / "../../tests/data/pdf/2206.01062.pdf"
|
||||||
|
|
||||||
pipeline_options = PdfPipelineOptions(
|
pipeline_options = PdfPipelineOptions(
|
||||||
enable_remote_services=True # <-- this is required!
|
enable_remote_services=True # <-- this is required!
|
||||||
|
@ -11,7 +11,7 @@ from docling.document_converter import DocumentConverter, PdfFormatOption
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
input_doc = Path("../../tests/data/pdf/2206.01062.pdf")
|
input_doc = Path(__file__) / "../../tests/data/pdf/2206.01062.pdf"
|
||||||
|
|
||||||
# Explicitly set the accelerator
|
# Explicitly set the accelerator
|
||||||
# accelerator_options = AcceleratorOptions(
|
# accelerator_options = AcceleratorOptions(
|
||||||
|
@ -9,7 +9,7 @@ from docling.document_converter import DocumentConverter, PdfFormatOption
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
input_doc = Path("../../tests/data/pdf/2206.01062.pdf")
|
input_doc = Path(__file__) / "../../tests/data/pdf/2206.01062.pdf"
|
||||||
|
|
||||||
# Set lang=["auto"] with a tesseract OCR engine: TesseractOcrOptions, TesseractCliOcrOptions
|
# Set lang=["auto"] with a tesseract OCR engine: TesseractOcrOptions, TesseractCliOcrOptions
|
||||||
# ocr_options = TesseractOcrOptions(lang=["auto"])
|
# ocr_options = TesseractOcrOptions(lang=["auto"])
|
||||||
|
@ -31,7 +31,7 @@ def translate(text: str, src: str = "en", dest: str = "de"):
|
|||||||
def main():
|
def main():
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
input_doc_path = Path("../../tests/data/pdf/2206.01062.pdf")
|
input_doc_path = Path(__file__) / "../../tests/data/pdf/2206.01062.pdf"
|
||||||
output_dir = Path("scratch")
|
output_dir = Path("scratch")
|
||||||
|
|
||||||
# Important: For operating with page images, we must keep them, otherwise the DocumentConverter
|
# Important: For operating with page images, we must keep them, otherwise the DocumentConverter
|
||||||
|
@ -69,8 +69,8 @@ def watsonx_vlm_options(model: str, prompt: str):
|
|||||||
def main():
|
def main():
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
# input_doc_path = Path("../../tests/data/pdf/2206.01062.pdf")
|
# input_doc_path = Path(__file__) / "../../tests/data/pdf/2206.01062.pdf"
|
||||||
input_doc_path = Path("../../tests/data/pdf/2305.03393v1-pg9.pdf")
|
input_doc_path = Path(__file__) / "../../tests/data/pdf/2305.03393v1-pg9.pdf"
|
||||||
|
|
||||||
pipeline_options = VlmPipelineOptions(
|
pipeline_options = VlmPipelineOptions(
|
||||||
enable_remote_services=True # <-- this is required!
|
enable_remote_services=True # <-- this is required!
|
||||||
|
Loading…
Reference in New Issue
Block a user