Creating your Python inference class
Model
def predict(self, X: Union[np.ndarray, List, str, bytes, Dict], names: Optional[List[str]], meta: Optional[Dict] = None) -> Union[np.ndarray, List, str, bytes, Dict]:class MyModel(object):
"""
Model template. You can load your model parameters in __init__ from a location accessible at runtime
"""
def __init__(self):
"""
Add any initialization parameters. These will be passed at runtime from the graph definition parameters defined in your seldondeployment kubernetes resource manifest.
"""
print("Initializing")
def predict(self, X, features_names=None):
"""
Return a prediction.
Parameters
----------
X : array-like
feature_names : array of feature names (optional)
"""
print("Predict called - will run identity function")
return XReturning class names
Examples
Transformers
Combiners
Routers
Adding Custom Metrics
Returning Tags
Runtime Metrics and Tags
REST Health Endpoint
Low level Methods
User Defined Exceptions
Multi-value numpy arrays
Gunicorn and load
Integer numbers
Incubating features
REST Metadata Endpoint
Example format:
Validation
Examples:
Next Steps
Last updated
Was this helpful?