in src/sagemaker_mxnet_serving_container/default_inference_handler.py [0:0]
def default_output_fn(self, prediction, accept):
"""Serialize the prediction into a response.
Args:
prediction (mxnet.nd.array): an MXNet NDArray that is the result of a prediction
accept (str): the accept content type expected by the client
Returns:
obj: prediction data.
Raises:
sagemaker_inference.errors.UnsupportedFormatError: if an unsupported content type is used.
"""
for content_type in parse_accept(accept):
if content_type in self.VALID_CONTENT_TYPES:
return encoder.encode(prediction.asnumpy().tolist(), content_type)
raise errors.UnsupportedFormatError(accept)