How can I convert bentoml example v0.13.2 -> v1.0.5 #2962
Answered
by
aarnphm
KimSoungRyoul
asked this question in
Q&A
-
v0.13.2import pandas as pd
from bentoml import env, artifacts, api, BentoService
from bentoml.adapters import DataframeInput, JsonOutput
from bentoml.frameworks.sklearn import SklearnModelArtifact
# BentoML packages local python modules automatically for deployment
from my_ml_utils import my_encoder
@env(infer_pip_packages=True)
@artifacts([SklearnModelArtifact('my_model')])
class MyPredictionService(BentoService):
"""
A simple prediction service exposing a Scikit-learn model
"""
@api(input=DataframeInput(), output=JsonOutput(), batch=True)
def predict(self, df: pd.DataFrame):
"""
An inference API named `predict` that takes tabular data in pandas.DataFrame
format as input, and returns Json Serializable value as output.
A batch API is expect to receive a list of inference input and should returns
a list of prediction results.
"""
model_input_df = my_encoder.fit_transform(df)
predictions = self.artifacts.my_model.predict(model_input_df)
return list(predictions) v1.0.5???? |
Beta Was this translation helpful? Give feedback.
Answered by
aarnphm
Sep 1, 2022
Replies: 2 comments
-
Hi there, please see our migration guide |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
KimSoungRyoul
-
Oh, I asked you a stupid question thank you for your answer |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there, please see our migration guide