MLServer icon indicating copy to clipboard operation
MLServer copied to clipboard

Support Unions in simplified interface

Open adriangonz opened this issue 3 years ago • 0 comments

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
	...

adriangonz avatar Oct 04 '22 16:10 adriangonz