from PIL import Image
from vlmrun.client import VLMRun
from vlmrun.client.types import PredictionResponse, GenerationConfig
# Initialize the client
client = VLMRun(api_key="your-api-key")
# Process the image with the custom schema
image = Image.open("path/to/image.jpg")
prediction: PredictionResponse = client.image.generate(
images=[image],
domain="image.caption",
config=GenerationConfig(
json_schema=ImagePrediction.model_json_schema()
)
)
response_dict = prediction.response.model_dump()