デプロイされたサービスから推論をリクエストする (AWS CLI) - Amazon SageMaker AI

デプロイされたサービスから推論をリクエストする (AWS CLI)

Amazon SageMaker AI エンドポイント InService を取得すると、sagemaker-runtime invoke-endpoint を使用して推論リクエストを行えます。推論リクエストは、AWS Command Line Interface (AWS CLI) を使って行えます。次の例は、推論用のイメージを送信する方法を示しています。

aws sagemaker-runtime invoke-endpoint --endpoint-name 'insert name of your endpoint here' --body fileb://image.jpg --content-type=application/x-image output_file.txt

推論が成功した場合は、推論リクエストに関する情報が含まれた output_file.txt が作成されます。

TensorFlow の場合、コンテンツタイプが application/json の入力を送信します。

aws sagemaker-runtime invoke-endpoint --endpoint-name 'insert name of your endpoint here' --body fileb://input.json --content-type=application/json output_file.txt