Error decoding a response from invoking a sageMaker endpoint
I am invoking a sageMaker endpoint that returns an image from a tensorflow model using thecode below. I got a 200 response but I can't parse the predictions, the decoding of the response is throwing the following error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 23: invalid start byte
This is my actual code:
pose_array = np.empty([16,3])
images = [{"b64": read_from_url(url)} for url in urls]
input_data = [{''keypoints': pose_array, 'images': list_of_images}]
body = json.dumps({"signature_name": "serving_default", "instances": input_data})
response = client.invoke_endpoint(
EndpointName=endpoint_name,
ContentType=''application/json',
Body=body,
Accept='Accept')
response = response.get("Body").read().decode()
the response can't be decoded, so I can't get the predictions
Also been hitting this issue.
Is your container in python 2.7?
no, I am using python 3.6
Hey guys, I am having the same issue. Any resolution? Thanks.
I have the similar issue. I tried both Python 3.6 and 3.8, response['Body'].read().decode() doesn't include any prediction score.
I am having the same issue: data = serialized_input_data.decode('utf-8') AttributeError: 'str' object has no attribute 'decode'
Moving this issue to the SageMaker Python SDK repository because it isn't associated with an example notebook.
hello, this looks like a boto3 issue not a sagemaker sdk issue. I would recommend opening an issue with the boto3 codebase here
Closing as should be transferred to boto3. Thank you!