PaliGemma 2
Use Google's PaliGemma 2 vision-language model through our Serverless Hosted API
Code sample
pip install inference-sdkimport os
import urllib.request
from inference_sdk import InferenceHTTPClient
image_url = "https://media.roboflow.com/notebooks/examples/dog.jpeg"
image_path = "dog.jpeg"
urllib.request.urlretrieve(image_url, image_path)
client = InferenceHTTPClient(
api_url="https://serverless.roboflow.com",
api_key=os.getenv("API_KEY"),
)
result = client.infer_lmm(
image_path,
model_id="paligemma2-3b-pt-224",
prompt="caption en",
max_new_tokens=64,
)
print(result["response"])Last updated
Was this helpful?