Slackbot
01/23/2023, 10:30 PMBo
01/23/2023, 10:31 PMSean
01/24/2023, 2:49 AMPaulo Eduardo Neves
01/24/2023, 2:22 PMimport numpy as np
import bentoml
from <http://bentoml.io|bentoml.io> import NumpyNdarray
iris_clf_runner = bentoml.sklearn.get("iris_clf:latest").to_runner()
svc = bentoml.Service("iris_classifier", runners=[iris_clf_runner])
@svc.api(
input=NumpyNdarray.from_sample(
np.array([[4.9, 3.0, 1.4, 0.2]], dtype=np.double), enforce_shape=False
),
output=NumpyNdarray.from_sample(np.array([0.0], dtype=np.double)),
)
async def classify(input_series: np.ndarray) -> np.ndarray:
return await iris_clf_runner.predict.async_run(input_series)
@svc.api(
input=NumpyNdarray.from_sample(
np.array([[4.9, 3.0, 1.4, 0.2]], dtype=np.double), enforce_shape=False
),
output=NumpyNdarray.from_sample(np.array([0.0], dtype=np.double)),
)
def classify_sync(input_series: np.ndarray) -> np.ndarray:
return iris_clf_runner.predict.run(input_series)
The classify
is the same of the tutorial. The classify_sync
was made by me.
Thanks for your time and sorry for the delay. I wrote the message at the end of my working day.Paulo Eduardo Neves
01/24/2023, 2:25 PMbentofile.yml
I needed to hardcode python versoin to 3.7 and put fixed pandas and sklearn versions in the requirements file:
service: "service.py:svc"
labels:
owner: bentoml-team
project: gallery
include:
- "*.py"
python:
requirements_txt: "requirements.txt"
docker:
python_version: "3.7"
env:
- PORT=3003
Paulo Eduardo Neves
01/25/2023, 9:29 PM--production
flag?Sean
01/30/2023, 10:28 AMPaulo Eduardo Neves
01/30/2023, 9:00 PM--production
flag