Update handler.py
Browse files- handler.py +2 -4
handler.py
CHANGED
@@ -7,15 +7,13 @@ import base64
|
|
7 |
|
8 |
class EndpointHandler():
|
9 |
def __init__(self, path=""):
|
10 |
-
self.pipeline = pipeline("zero-shot-image-classification", device=0)
|
11 |
|
12 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
13 |
inputs = data.pop("inputs", {})
|
14 |
parameters = data.pop("parameters", {})
|
15 |
candidate_labels = parameters.pop("candidate_labels", [])
|
16 |
-
print("
|
17 |
-
print("input: ", parameters)
|
18 |
-
print("input: ", candidate_labels)
|
19 |
|
20 |
# decode base64 image to PIL
|
21 |
image = Image.open(BytesIO(base64.b64decode(inputs)))
|
|
|
7 |
|
8 |
class EndpointHandler():
|
9 |
def __init__(self, path=""):
|
10 |
+
self.pipeline = pipeline("zero-shot-image-classification", model=path, device=0)
|
11 |
|
12 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
13 |
inputs = data.pop("inputs", {})
|
14 |
parameters = data.pop("parameters", {})
|
15 |
candidate_labels = parameters.pop("candidate_labels", [])
|
16 |
+
print("data: ", data)
|
|
|
|
|
17 |
|
18 |
# decode base64 image to PIL
|
19 |
image = Image.open(BytesIO(base64.b64decode(inputs)))
|