Spaces:
Running
Running
Smoldocling CLI
A command-line interface for processing document images and PDFs using Smoldocling-256-preview model.
Installation
- Clone this repository
- Install the required dependencies:
pip install -r requirements.txt
Usage
The CLI supports processing one or multiple document images and PDFs at once. The processed output will be saved as HTML files.
Basic usage:
python smoldocling_cli.py input1.png input2.jpg input3.pdf
Specify output directory:
python smoldocling_cli.py -o custom_output input1.png document.pdf
Arguments
input_files
: One or more input files (images or PDFs) to process-o, --output-dir
: Output directory for HTML files (default: 'output')
Example
python smoldocling_cli.py document1.png document2.pdf -o processed_docs
This will:
- Process document1.png and generate document1.html
- Process document2.pdf and generate document2.html (containing all pages in a single file)
- Create a directory called 'processed_docs' if it doesn't exist
- Save all HTML files in the processed_docs directory
Notes
- The script will automatically create the output directory if it doesn't exist
- Each input image file will generate a corresponding HTML file with the same name (but .html extension)
- PDF files will generate a single HTML file containing all pages
- Currently, PDF processing is limited to the first 3 pages due to model limitations
- Failed processing of one file won't stop the processing of other files
- Error messages will be printed to stderr
- The model is loaded only once for processing multiple files