Florence 2
Serverless Hosted API を通じて Microsoft の Florence 2 multimodal model を使用します
最終更新
役に立ちましたか?
役に立ちましたか?
export ROBOFLOW_API_KEY="your-key-here"curl --location 'https://serverless.roboflow.com/infer/lmm' \
--header 'Content-Type: application/json' \\
--data '{
"api_key": "'"$ROBOFLOW_API_KEY"'",
"image": {"type": "url", "value": "https://media.roboflow.com/quickstart/dog.jpeg"},
"model_id": "florence-2-base",
"prompt": "<CAPTION>"
}'export ROBOFLOW_API_KEY="your-key-here"pip install inference-sdkimport os
import cv2
import numpy as np
import requests
from inference_sdk import InferenceHTTPClient
content = requests.get("https://media.roboflow.com/quickstart/dog.jpeg").content
image = cv2.imdecode(np.frombuffer(content, np.uint8), cv2.IMREAD_COLOR)
client = InferenceHTTPClient(
api_url="https://serverless.roboflow.com",
api_key=os.environ["ROBOFLOW_API_KEY"],
)
result = client.infer_lmm(
inference_input=image,
model_id="florence-2-base",
prompt="<CAPTION>",
)
print(result["response"]) # {'<CAPTION>': 'A man carrying a dog on his back.'}