Skip to content

Can I invoke the service handler of model 2 from the service handler of model 1 ? #928

Answered by parano
jesudasvf asked this question in General
Discussion options

You must be logged in to vote

Hi @jesudasvf - yes certainly you can do that.

There is one example with multiple models in the doc that shows you can have multiple models bundled with one BentoService: https://docs.bentoml.org/en/latest/concepts.html#packaging-model-artifacts

import bentoml
from bentoml.adapters import DataframeInput
from bentoml.artifact import SklearnModelArtifact, XgboostModelArtifact

@bentoml.env(infer_pip_packages=True)
@artifacts([
    SklearnModelArtifact("model_a"),
    XgboostModelArtifact("model_b")
])
class MyPredictionService(bentoml.BentoService):

    @bentoml.api(input=DataframeInput(), batch=True)
    def predict(self, df):
        # assume the output of model_a will be the input of mo…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jesudasvf
Comment options

Answer selected by yubozhao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants