BentoML icon indicating copy to clipboard operation
BentoML copied to clipboard

enhancement: Dynamically add endpoints to Service

Open holzweber opened this issue 5 months ago • 0 comments

Feature request

Depending on available models, support the possibility to add endpoints to a service.

Main Idea (only a draft, does not work like this in python)

import numpy as np
import bentoml
from bentoml.io import NumpyNdarray

# assuming modeltags holds all available models on device
runner_list = []
for model_tag in modeltags:
    runner_list.add[bentoml.sklearn.get("model_tag").to_runner()]

svc = bentoml.Service("detection", runners=runner_list)


for idx in range(len(runner_list)):
	@svc.api(input=NumpyNdarray(), output=NumpyNdarray(), route=f"runner_{idx}")
	def classify(input_series: np.ndarray) -> np.ndarray:
		result = iris_clf_runner[i].predict.run(input_series)
		return result

Motivation

This feature would solve the problem of not having the possibility to dynamically add endpoints to a service

Other

No response

holzweber avatar Jan 30 '24 17:01 holzweber