This message was deleted.
# ask-for-help
s
This message was deleted.
b
@Aaron Pham can you take a look?
s
@Paulo Eduardo Neves Could you please share the service.py code you have?
p
Here it is.
Copy code
import 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.
here is my
bentofile.yml
I needed to hardcode python versoin to 3.7 and put fixed pandas and sklearn versions in the requirements file:
Copy code
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
Whats the use of the
--production
flag?
s
@Paulo Eduardo Neves I’m unable to reproduce, unfortunately. I suspect the runner may not have started successfully. How much resources are you assigning to the container?
p
using default values. This is a simple service. The stack trace in first message don't look like a lack of resources. It works without the
--production
flag