通过已部署服务 (Amazon CLI) 请求推理 - 亚马逊 SageMaker AI
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

通过已部署服务 (Amazon CLI) 请求推理

拥有 Amazon SageMaker AI 端点 InService 后,即可使用 sagemaker-runtime invoke-endpoint 提出推理请求。您可以使用 Amazon Command Line Interface (Amazon 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