Skip to content

Commit

Permalink
Added missing response_headers variable in predict call.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrews Arokiam <[email protected]>
  • Loading branch information
andyi2it committed Nov 29, 2023
1 parent 000d79d commit d4fd668
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions python/lgbserver/lgbserver/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def test_model():
{'sepal_width_(cm)': 3.5}, {'petal_length_(cm)': 1.4},
{'petal_width_(cm)': 0.2}, {'sepal_length_(cm)': 5.1}
]
response = model.predict({"inputs": [request, request]})
response, response_headers = model.predict({"inputs": [request, request]})
assert numpy.argmax(response["predictions"][0]) == 2

response = model.predict({"instances": [request, request]})
response, response_headers = model.predict({"instances": [request, request]})
assert numpy.argmax(response["predictions"][0]) == 2

# test v2 handler
Expand Down
3 changes: 2 additions & 1 deletion python/test_resources/graph/success_200_isvc/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def load(self):
self.ready = True

def predict(self, payload: Union[Dict, InferRequest, ModelInferRequest], headers) -> Dict:
return {"message": "SUCCESS"}
response_headers = {}
return {"message": "SUCCESS"}, response_headers


DEFAULT_MODEL_NAME = "model"
Expand Down

0 comments on commit d4fd668

Please sign in to comment.