Class Serializer (1.36.0)

Serializer()

Interface to implement serialization and deserialization for prediction.

Methods

deserialize

deserialize(data: typing.Any, content_type: typing.Optional[str]) -> typing.Any

Deserializes the request data. Invoked before predict.

Parameters
NameDescription
content_type str

Optional. The specified content type of the request.

data Any

Required. The request data sent to the application.

serialize

serialize(prediction: typing.Any, accept: typing.Optional[str]) -> typing.Any

Serializes the prediction results. Invoked after predict.

Parameters
NameDescription
accept str

Optional. The specified content type of the response.

prediction Any

Required. The generated prediction to be sent back to clients.