Upload handler.py
Browse files- handler.py +9 -2
handler.py
CHANGED
|
@@ -12,5 +12,12 @@ class EndpointHandler:
|
|
| 12 |
|
| 13 |
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
|
| 14 |
inputs = data.pop("inputs", data)
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
|
| 14 |
inputs = data.pop("inputs", data)
|
| 15 |
+
parameters = data.pop("parameters", None)
|
| 16 |
+
|
| 17 |
+
# pass inputs with all kwargs in data
|
| 18 |
+
if parameters is not None:
|
| 19 |
+
prediction = self.pipeline(inputs, **parameters)
|
| 20 |
+
else:
|
| 21 |
+
prediction = self.pipeline(inputs)
|
| 22 |
+
# postprocess the prediction
|
| 23 |
+
return prediction
|