update params
Browse files- handler.py +7 -3
handler.py
CHANGED
|
@@ -17,11 +17,15 @@ class EndpointHandler():
|
|
| 17 |
Return:
|
| 18 |
A :obj:`list`:. The list contains items that are dicts should be liked {"label": "XXX", "score": 0.82}
|
| 19 |
"""
|
| 20 |
-
inputs = data.pop("inputs", data)
|
|
|
|
|
|
|
|
|
|
| 21 |
# decode base64 image to PIL
|
| 22 |
-
image = Image.open(BytesIO(base64.b64decode(
|
| 23 |
|
| 24 |
-
parameters =
|
|
|
|
| 25 |
candidate_labels = parameters['candidate_labels']
|
| 26 |
|
| 27 |
# run prediction one image wit provided candiates
|
|
|
|
| 17 |
Return:
|
| 18 |
A :obj:`list`:. The list contains items that are dicts should be liked {"label": "XXX", "score": 0.82}
|
| 19 |
"""
|
| 20 |
+
#inputs = data.pop("inputs", data)
|
| 21 |
+
#image_data = inputs['image']
|
| 22 |
+
|
| 23 |
+
image_data = data.pop("image", data)
|
| 24 |
# decode base64 image to PIL
|
| 25 |
+
image = Image.open(BytesIO(base64.b64decode(image_data)))
|
| 26 |
|
| 27 |
+
parameters = data.pop("parameters", data)
|
| 28 |
+
#parameters = inputs['parameters']
|
| 29 |
candidate_labels = parameters['candidate_labels']
|
| 30 |
|
| 31 |
# run prediction one image wit provided candiates
|