MLServer
MLServer copied to clipboard
Support Unions in simplified interface
Following the initial work done in #765 and, as suggested in https://github.com/SeldonIO/MLServer/issues/697#issuecomment-1267245839, it would be useful to introduce support for Unions in simplified predict() interfaces. This would allow for use cases where data types are variable, e.g.
@decode_args
def predict(self, payload: Union[np.ndarray, pd.Dataframe]) -> np.ndarray:
# `payload` would be either a `np.ndarray` or a `pd.DataFrame`, depending what fits best the request payload
...