For the complete documentation index, see llms.txt. This page is also available as Markdown.

PaliGemma 2

हमारे Serverless Hosted API के माध्यम से Google के PaliGemma 2 vision-language model का उपयोग करें

PaliGemma 2 Google का vision-language model है। यह एक image और एक text prompt स्वीकार करता है और text response लौटाता है। हम PaliGemma 2 को अपने Serverless Hosted API, Dedicated Deploymentsऔर self-hosted Inference.

Code sample

इंस्टॉल करें Inference SDK:

pip install inference-sdk

अपना Roboflow API Key के माध्यम से API_KEY environment variable के माध्यम से support करते हैं। sample pretrained paligemma2-3b-pt-224 checkpoint को एक caption prompt के साथ call करता है।

import 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"]))

ऊपर दिया गया code model response को terminal पर print करता है:

सेट करें api_url को अपने deployment target से मिलाने के लिए:

  • https://serverless.roboflow.com Serverless Hosted API के लिए।

  • http://localhost:9001 एक local Inference server के लिए।

  • आपका Dedicated Deployment private endpoint के लिए URL।

आप Roboflow पर अपना खुद का PaliGemma 2 checkpoint train कर सकते हैं और इसे उसके workspace/project/version identifier से call कर सकते हैं। देखें Inference documentation अतिरिक्त prompt formats और supported checkpoints के लिए।

अंतिम अपडेट

क्या यह उपयोगी था?