def predict(): model = LocalProxy(get_model) json_data = json.loads(request.get_json()) print(json_data) sample_feats = np.array(json_data["features"]).reshape(1, -1) print(sample_feats) response = {"prediction_result": float(model.predict(sample_feats)[0])} return response
def test(): model = LocalProxy(get_model) sample_feats = np.array([[ 1.86822575, 1.36307704, -1.99493428, 4.17351574, 1.23975095, -0.74618646, 0.57273053, -0.13123484, -1.55183852, 0.22884943, 1.70189471, 0.14462239, 0.10408768, -2.95416672, -1.37412193, 1.88941746, 1.71451074, 1.10465991, -1.59744021, -0.1722165, -0.30100148, -0.81897228, 0.20681231, -0.26368303, -0.1149581, -0.24067212, -0.00662945, 0.01725773, 3.14 ]]) #print(sample_feats.shape) response = {"prediction_result": float(model.predict(sample_feats)[0])} return response