def __init__(<EOL>self,<EOL>model,<EOL>predict,<EOL>input_validation=lambda data: (True, None),<EOL>data_loader=json_numpy_loader,<EOL>preprocessor=lambda x: x,<EOL>postprocessor=make_serializable,<EOL>to_numpy=True):
self.model = model<EOL>self.predict = predict<EOL>self.data_loader = data_loader<EOL>self.preprocessor = preprocessor<EOL>self.postprocessor = postprocessor<EOL>self.app = Flask('<STR_LIT>'.format(self.__class__.__name__, type(predict).__name__))<EOL>self.api = Api(self.app, catch_all_404s=True)<EOL>self._create_prediction_endpoint(<EOL>data_loader=data_loader,<EOL>input_validation=input_validation,<EOL>preprocessor=preprocessor,<EOL>postprocessor=postprocessor,<EOL>to_numpy=to_numpy,<EOL>)<EOL>logger.info('<STR_LIT>')<EOL>self.app.logger.setLevel(logger.level)  <EOL>self._create_model_info_endpoint()<EOL>
Initialize class with prediction function.

        Arguments:
            - predict (fn): function that takes a numpy array of features as input,
                and returns a prediction of targets
            - input_validation (fn): takes a numpy array as input;
                returns True if validation passes and False otherwise
            - data_loader (fn): reads flask request and returns data preprocessed to be
                used in the `predict` method
            - postprocessor (fn): transforms the predictions from the `predict` method