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' )

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

gefragt vor 10 Monaten298 Aufrufe
1 Antwort
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
EXPERTE
beantwortet vor 10 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen