Calling Image Classification Model Deployed in SageMaker Endpoint

Ah ok, that is helpful. I believe the problem is that Sagemaker predictor uses (I believe) the JSON serializer when not specified otherwise.

Have a look at this sample notebook that also handles images: notebooks/sagemaker-notebook.ipynb at main · huggingface/notebooks · GitHub

You can see that this notebook uses a DataSerializer instead:

# create a serializer for the data
image_serializer = DataSerializer(content_type='image/x-image') # using x-image to support multiple image formats

# deploy model to SageMaker Inference
predictor = huggingface_model.deploy(
	initial_instance_count=1, # number of instances
	instance_type='ml.g4dn.xlarge', # ec2 instance type
    serializer=image_serializer, # serializer for image data.
)

Hopefully that fixes your issue. You can learn more about Sagemaker Serializers here

Cheers
Heiko