zesquirrelnator commited on
Commit
ca1562b
·
verified ·
1 Parent(s): 300ebb7

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +2 -4
handler.py CHANGED
@@ -20,15 +20,13 @@ class EndpointHandler:
20
  img = Image.open(BytesIO(decoded_image)).convert("RGB")
21
  return img
22
 
23
- def handle(self, event, context):
24
  """Handle the incoming request."""
25
  try:
26
  # Extract the inputs from the event
27
- data = event['body']
28
  inputs = data.pop("inputs", data)
29
- print(inputs)
30
  input_image = inputs['image']
31
- question = inputs['question']
32
 
33
  # Preprocess the image
34
  img = self.preprocess_image(input_image)
 
20
  img = Image.open(BytesIO(decoded_image)).convert("RGB")
21
  return img
22
 
23
+ def __call__(self, data, context):
24
  """Handle the incoming request."""
25
  try:
26
  # Extract the inputs from the event
 
27
  inputs = data.pop("inputs", data)
 
28
  input_image = inputs['image']
29
+ question = inputs.get('question', "move to the red ball")
30
 
31
  # Preprocess the image
32
  img = self.preprocess_image(input_image)