model_server.core
Servable Objects
__init__
Abstract base class for custom servables. All custom servables must inherit from this. All custom servables inheriting from this must implement the following methods:
predict
Abstract method where the model prediction logic lives. This method is responsible for the gRPC call GetPredictions(). All custom servables must define this method.
Arguments:
input_array_dict
dict - The PredictionRequest proto decoded as a python dictionary.
Returns:
A python dictionary with key (typically output name) and value as numpy array of predictions
get_model_info
Abstract method which is responsible for the call GetModelInfo
Arguments:
list_of_model_info_dict
list/tuple - A list containing model_info_dicts
Notes:
model_info_dict contains the following keys:
1 2 3 4 5 6 7 8 |
|
Returns:
list_of_model_info_dict
dict - containing the model and server info. This is similar to the function input
ModelServerServicer Objects
__init__
gRPC Model Server Services. This is where the RPC methods are defined.
Arguments:
custom_servable_object
- custom servable classe's instance
GetPredictions
Entrypoint for GetPredictions gRPC call. Uses the predict method defined in custom servable
Arguments:
request
protobuf - gRPC request containing input PredictRequest protobufcontext
protobuf - gRPC context object
Returns:
PredictResponse protobuf
GetModelInfo
Entrypoint for GetModelInfo gRPC call. Uses the get_model_info method defined in custom servable
Arguments:
request
protobuf - gRPC request containing input ModelInfo protobufcontext
protobuf - gRPC context object
Returns:
ModelInfo protobuf