ts.torch_handler.request_envelope package¶
Submodules¶
ts.torch_handler.request_envelope.base module¶
Base class for all RequestEnvelope.
A request envelope reformats the inputs/outputs of a call to a handler. It translates from formats specific to a model orchestrator like Seldon or KServe to a set of flat Python items, and vice versa.
ts.torch_handler.request_envelope.body module¶
Default class for all handlers. Grabs the data out of the request body.
ts.torch_handler.request_envelope.json module¶
Uses JSON formatted inputs/outputs, following the structure outlined in https://www.tensorflow.org/tfx/serving/api_rest
ts.torch_handler.request_envelope.kserve module¶
The KServe Envelope is used to handle the KServe Input Request inside Torchserve.
- class ts.torch_handler.request_envelope.kserve.KServeEnvelope(handle_fn)[source]¶
Bases:
BaseEnvelope
This function is used to handle the input request specified in kserve format and converts it into a Torchserve readable format.
- Parameters:
Format (data - List of Input Request in kserve) –
- Returns:
Returns the list of the Input Request in Torchserve Format
- Return type:
[list]
- format_output(data)[source]¶
Returns the prediction response and captum explanation response of the input request.
- Parameters:
outputs (List) – The outputs arguments is in the form of a list of dictionaries.
- Returns:
The response is returned as a list of predictions and explanations
- Return type:
(list)