(
input_sources: Annotated[
List[str],
typer.Argument(
...,
metavar="source",
help="PDF files to convert. Can be local file / directory paths or URL.",
),
],
from_formats: List[InputFormat] = typer.Option(
None,
"--from",
help="Specify input formats to convert from. Defaults to all formats.",
),
to_formats: List[OutputFormat] = typer.Option(
None, "--to", help="Specify output formats. Defaults to Markdown."
),
headers: str = typer.Option(
None,
"--headers",
help="Specify http request headers used when fetching url input sources in the form of a JSON string",
),
image_export_mode: Annotated[
ImageRefMode,
typer.Option(
...,
help="Image export mode for the document (only in case of JSON, Markdown or HTML). With `placeholder`, only the position of the image is marked in the output. In `embedded` mode, the image is embedded as base64 encoded string. In `referenced` mode, the image is exported in PNG format and referenced from the main exported document.",
),
] = ImageRefMode.EMBEDDED,
ocr: Annotated[
bool,
typer.Option(
..., help="If enabled, the bitmap content will be processed using OCR."
),
] = True,
force_ocr: Annotated[
bool,
typer.Option(
...,
help="Replace any existing text with OCR generated text over the full content.",
),
] = False,
ocr_engine: Annotated[
OcrEngine, typer.Option(..., help="The OCR engine to use.")
] = OcrEngine.EASYOCR,
ocr_lang: Annotated[
Optional[str],
typer.Option(
...,
help="Provide a comma-separated list of languages used by the OCR engine. Note that each OCR engine has different values for the language names.",
),
] = None,
pdf_backend: Annotated[
PdfBackend, typer.Option(..., help="The PDF backend to use.")
] = PdfBackend.DLPARSE_V2,
table_mode: Annotated[
TableFormerMode,
typer.Option(..., help="The mode to use in the table structure model."),
] = TableFormerMode.FAST,
enrich_code: Annotated[
bool,
typer.Option(..., help="Enable the code enrichment model in the pipeline."),
] = False,
enrich_formula: Annotated[
bool,
typer.Option(..., help="Enable the formula enrichment model in the pipeline."),
] = False,
enrich_picture_classes: Annotated[
bool,
typer.Option(
...,
help="Enable the picture classification enrichment model in the pipeline.",
),
] = False,
enrich_picture_description: Annotated[
bool,
typer.Option(..., help="Enable the picture description model in the pipeline."),
] = False,
artifacts_path: Annotated[
Optional[Path],
typer.Option(..., help="If provided, the location of the model artifacts."),
] = None,
abort_on_error: Annotated[
bool,
typer.Option(
...,
"--abort-on-error/--no-abort-on-error",
help="If enabled, the bitmap content will be processed using OCR.",
),
] = False,
output: Annotated[
Path, typer.Option(..., help="Output directory where results are saved.")
] = Path("."),
verbose: Annotated[
int,
typer.Option(
"--verbose",
"-v",
count=True,
help="Set the verbosity level. -v for info logging, -vv for debug logging.",
),
] = 0,
debug_visualize_cells: Annotated[
bool,
typer.Option(..., help="Enable debug output which visualizes the PDF cells"),
] = False,
debug_visualize_ocr: Annotated[
bool,
typer.Option(..., help="Enable debug output which visualizes the OCR cells"),
] = False,
debug_visualize_layout: Annotated[
bool,
typer.Option(
..., help="Enable debug output which visualizes the layour clusters"
),
] = False,
debug_visualize_tables: Annotated[
bool,
typer.Option(..., help="Enable debug output which visualizes the table cells"),
] = False,
version: Annotated[
Optional[bool],
typer.Option(
"--version",
callback=version_callback,
is_eager=True,
help="Show version information.",
),
] = None,
document_timeout: Annotated[
Optional[float],
typer.Option(
...,
help="The timeout for processing each document, in seconds.",
),
] = None,
num_threads: Annotated[int, typer.Option(..., help="Number of threads")] = 4,
device: Annotated[
AcceleratorDevice, typer.Option(..., help="Accelerator device")
] = AcceleratorDevice.AUTO,
)
| 153 | |
| 154 | @app.command(no_args_is_help=True) |
| 155 | def convert( |
| 156 | input_sources: Annotated[ |
| 157 | List[str], |
| 158 | typer.Argument( |
| 159 | ..., |
| 160 | metavar="source", |
| 161 | help="PDF files to convert. Can be local file / directory paths or URL.", |
| 162 | ), |
| 163 | ], |
| 164 | from_formats: List[InputFormat] = typer.Option( |
| 165 | None, |
| 166 | "--from", |
| 167 | help="Specify input formats to convert from. Defaults to all formats.", |
| 168 | ), |
| 169 | to_formats: List[OutputFormat] = typer.Option( |
| 170 | None, "--to", help="Specify output formats. Defaults to Markdown." |
| 171 | ), |
| 172 | headers: str = typer.Option( |
| 173 | None, |
| 174 | "--headers", |
| 175 | help="Specify http request headers used when fetching url input sources in the form of a JSON string", |
| 176 | ), |
| 177 | image_export_mode: Annotated[ |
| 178 | ImageRefMode, |
| 179 | typer.Option( |
| 180 | ..., |
| 181 | help="Image export mode for the document (only in case of JSON, Markdown or HTML). With `placeholder`, only the position of the image is marked in the output. In `embedded` mode, the image is embedded as base64 encoded string. In `referenced` mode, the image is exported in PNG format and referenced from the main exported document.", |
| 182 | ), |
| 183 | ] = ImageRefMode.EMBEDDED, |
| 184 | ocr: Annotated[ |
| 185 | bool, |
| 186 | typer.Option( |
| 187 | ..., help="If enabled, the bitmap content will be processed using OCR." |
| 188 | ), |
| 189 | ] = True, |
| 190 | force_ocr: Annotated[ |
| 191 | bool, |
| 192 | typer.Option( |
| 193 | ..., |
| 194 | help="Replace any existing text with OCR generated text over the full content.", |
| 195 | ), |
| 196 | ] = False, |
| 197 | ocr_engine: Annotated[ |
| 198 | OcrEngine, typer.Option(..., help="The OCR engine to use.") |
| 199 | ] = OcrEngine.EASYOCR, |
| 200 | ocr_lang: Annotated[ |
| 201 | Optional[str], |
| 202 | typer.Option( |
| 203 | ..., |
| 204 | help="Provide a comma-separated list of languages used by the OCR engine. Note that each OCR engine has different values for the language names.", |
| 205 | ), |
| 206 | ] = None, |
| 207 | pdf_backend: Annotated[ |
| 208 | PdfBackend, typer.Option(..., help="The PDF backend to use.") |
| 209 | ] = PdfBackend.DLPARSE_V2, |
| 210 | table_mode: Annotated[ |
| 211 | TableFormerMode, |
| 212 | typer.Option(..., help="The mode to use in the table structure model."), |
nothing calls this directly
no test coverage detected