Spaces:
Sleeping
Sleeping
Create testdocling.py
Browse files- testdocling.py +32 -0
testdocling.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import logging
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
from docling.document_converter import DocumentConverter
|
| 4 |
+
from docling.datamodel.base_models import InputFormat
|
| 5 |
+
from docling.datamodel.pipeline_options import PdfPipelineOptions
|
| 6 |
+
from docling.document_converter import PdfFormatOption
|
| 7 |
+
|
| 8 |
+
def test_docling_setup():
|
| 9 |
+
try:
|
| 10 |
+
# Basic setup test
|
| 11 |
+
pipeline_options = PdfPipelineOptions()
|
| 12 |
+
pipeline_options.do_ocr = False # Start simple without OCR
|
| 13 |
+
pipeline_options.do_table_structure = True
|
| 14 |
+
|
| 15 |
+
converter = DocumentConverter(
|
| 16 |
+
format_options={
|
| 17 |
+
InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)
|
| 18 |
+
}
|
| 19 |
+
)
|
| 20 |
+
print("✓ Basic setup successful")
|
| 21 |
+
return True
|
| 22 |
+
except ImportError as e:
|
| 23 |
+
print(f"✗ Import Error: {str(e)}")
|
| 24 |
+
print("Try: pip install docling")
|
| 25 |
+
return False
|
| 26 |
+
except Exception as e:
|
| 27 |
+
print(f"✗ Other Error: {str(e)}")
|
| 28 |
+
return False
|
| 29 |
+
|
| 30 |
+
if __name__ == "__main__":
|
| 31 |
+
logging.basicConfig(level=logging.INFO)
|
| 32 |
+
test_docling_setup()
|