通过已部署服务 (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