CLIP
画像を埋め込む
# リクエストペイロードを定義
infer_clip_payload = {
# 画像はURLまたはbase64エンコードされた文字列として提供できます
"image": {
# "type" は "base64" にすることもできます
"type": "url",
# "value" は画像データのbase64エンコード文字列にすることもできます
"value": "https://images.freeimages.com/images/large-previews/36c/raccoons-in-the-wild-4-1624830.jpg",
},
}
# 推論サーバーのURLを定義(localhost:9001、infer.roboflow.comなど)
base_url = "https://infer.roboflow.com"
# RoboflowのAPIキーを定義
api_key = <YOUR API KEY HERE>
res = requests.post(
f"{base_url}/clip/embed_image?api_key={api_key}",
json=infer_clip_payload,
)
embeddings = res.json()['embeddings']
print(embeddings)テキストを埋め込む
比較
Last updated
Was this helpful?