INNER CODE UNIT · Python
_load_document
mindee/doctr · doctr/cli/main.py:95
def _load_document(args: argparse.Namespace) -> list[np.ndarray]:
"""Load every input into a single list of pages
Args:
args: the parsed command-line arguments
Returns:
the list of pages decoded as numpy ndarray of shape H x W x 3
"""
pdf_kwargs: dict[str, Any] = {"scale": args.pdf_scale, "password": args.pdf_password}
pages: list[np.ndarray] = []
for input_path in args.input_path:
try:
if input_path.lower().startswith(("http://", "https://")):
pages.extend(DocumentFile.from_url(input_path, **pdf_kwargs))
elif input_path.lower().endswith(".pdf"):
pages.extend(DocumentFile.from_pdf(input_path, **pdf_kwargs))