load_predict_fn- either a
modelorload_model_fn
load_predict_fn returns a function predict_fn that takes in one argument representing model input, and outputs one argument representing model output.
Typically, a model would be a Pytorch nn.Module or Tensorflow model, but can also be any arbitrary Python code.
The predict_fn is a higher order function that contains how the model object will be used. This includes how the model object is called, and any pre- and post-processing needed.
Here is an example of a model bundle for an object detection model.
In the load_predict_fn, we split out the function into pre- and post- processing steps, and we call those functions in the predict function, which we return. Note that the return type must adhere to Nucleus annotation formatting.