Update handler.py
Browse files- handler.py +5 -10
handler.py
CHANGED
@@ -7,17 +7,12 @@ class EndpointHandler:
|
|
7 |
self.model = joblib.load(path + "/valid_trial_v3_2.joblib")
|
8 |
|
9 |
def __call__(self, data: Dict[str, Any]) -> List[Any]:
|
10 |
-
|
11 |
-
data args:
|
12 |
-
inputs (:obj: `str`)
|
13 |
-
date (:obj: `str`)
|
14 |
-
Return:
|
15 |
-
A :obj:`list`
|
16 |
-
"""
|
17 |
# get inputs
|
18 |
-
|
19 |
-
|
|
|
20 |
|
21 |
# run normal prediction
|
22 |
-
prediction = self.model.predict_proba(
|
23 |
return prediction
|
|
|
7 |
self.model = joblib.load(path + "/valid_trial_v3_2.joblib")
|
8 |
|
9 |
def __call__(self, data: Dict[str, Any]) -> List[Any]:
|
10 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
# get inputs
|
12 |
+
s_in = data.pop("inputs", data)
|
13 |
+
s_in = pd.Series(s_in)
|
14 |
+
d_in = pd.DataFrame(s_in).transpose()
|
15 |
|
16 |
# run normal prediction
|
17 |
+
prediction = self.model.predict_proba(d_in)[:, 1]
|
18 |
return prediction
|