PythonからSageMakerで作成したEndpointにアクセスするが反応が無い

0

こんにちは。 Ubuntu(22.04.2) の Python3(3.10.11) のコードから以下の様に SageMaker で作成した Endpoint にアクセスしても全く反応が返ってきません。 全く同じコードを Mac の Python3(3.9.13) から実行した場合は、問題無く結果が返ってきます。 セキュリティ・キーの設定も同じにしているので、SageMaker 以外の AWS サービスはどちらの環境でも同様に動作します。 Ubuntu の場合のみ反応が無い原因が分かりません。エラーは何も返ってきません。 何か心当たりのある方がいらっしゃれば、アドバイスお願いいたします。

import boto3 import json client = boto3.client('sagemaker-runtime') file_name = 'my_photos.jpg' endPoint = 'my-endpoint' with open(file_name, 'rb') as image: f = image.read() b = bytearray(f) endpoint_response = client.invoke_endpoint( EndpointName=endPoint, Body=b, ContentType='image/jpeg' )

以上、よろしくお願いします

質問済み 10ヶ月前291ビュー
1回答
0

"print(endpoint_response)"を確認してレスポンスが何も入っていないという認識で合っていますか?

import boto3 
import json 

client = boto3.client('sagemaker-runtime') 
file_name = 'my_photos.jpg' 
endPoint = 'my-endpoint' 
with open(file_name, 'rb') as image: 
    f = image.read() 
    b = bytearray(f) 
    endpoint_response = client.invoke_endpoint( EndpointName=endPoint, Body=b, ContentType='image/jpeg' )

    print(endpoint_response)
profile picture
エキスパート
回答済み 10ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン