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달 전298회 조회
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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인