Florence 2
Microsoft の Florence 2 マルチモーダルモデルを Serverless Cloud API で使用します
最終更新
役に立ちましたか?
役に立ちましたか?
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 -U inference-sdk supervisionimport os
import supervision as sv
from inference_sdk import InferenceHTTPClient
image = sv.load_image_from_url("https://media.roboflow.com/quickstart/dog.jpeg")
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>': '背中に犬を乗せた男性。'}pip install "inference[transformers]"from inference import get_model
model = get_model("florence-2-base", api_key="YOUR_API_KEY")
result = model.infer(
"https://media.roboflow.com/inference/seawithdock.jpeg",
prompt="<CAPTION>",
)
print(result[0].response)