Fluf22 commited on
Commit
13adaa6
·
verified ·
1 Parent(s): c6868f7

Update handler.py

Browse files
Files changed (1) hide show
  1. 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("input: ", inputs)
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)))