INNER CODE UNIT · Python

_save_results

mindee/doctr · doctr/cli/main.py:279

def _save_results(result: Any, fmt: str, args: argparse.Namespace) -> None:
    """Export the predictions and write them to disk

    Args:
        result: the document returned by the predictor
        fmt: the canonical export format
        args: the parsed command-line arguments
    """
    try:
        exported = result.export_as(fmt, **_export_kwargs(fmt, args))
    except Exception as e:
        logger.error(f"Results could not be exported as '{fmt}': {e}")
        sys.exit(1)

    try:
        if fmt == "xml":
            # `export_as_xml` returns one (bytes, ElementTree) tuple per page
            paths = _xml_paths(args.output, len(exported))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…