from pathlib import Pathfrom vlmrun.client import VLMRunfrom vlmrun.client.types import PredictionResponse# Initialize the clientclient = VLMRun()# Process a PDF document with a predefined schema# Note: Since the file is passed as a file path, it will be uploaded to the VLM Run server.response: PredictionResponse = client.document.generate( file=Path("path/to/document.pdf"), domain="document.markdown",)
The VLM Run SDK provides several document-processing utilities for encoding and downloading documents.
Copy
from pathlib import Pathfrom vlmrun.common.pdf import pdf_images# Read a PDF file and return an iterator of imagesimages: Iterator[Image.Image] = pdf_images(Path("path/to/document.pdf"))for image in images: print(image)