added support for tags to categorise the models

This commit is contained in:
faraphel 2025-01-10 11:08:10 +01:00
parent b89fafdc96
commit c6d779f591
3 changed files with 9 additions and 1 deletions

View file

@ -1,5 +1,6 @@
{
"type": "python",
"tags": ["dummy"],
"file": "model.py",
"inputs": {

View file

@ -68,7 +68,12 @@ class PythonModel(base.BaseModel):
infer_api.__signature__ = inspect.Signature(parameters=parameters)
# add the inference endpoint on the API
self.manager.application.add_api_route(f"/models/{self.name}/infer", infer_api, methods=["POST"])
self.manager.application.add_api_route(
f"/models/{self.name}/infer",
infer_api,
methods=["POST"],
tags=self.tags,
)
def _load(self) -> None:
return self.module.load(self)

View file

@ -18,6 +18,8 @@ class BaseModel(abc.ABC):
self.manager = manager
# the mimetype of the model responses
self.output_type: str = configuration.get("output_type", "application/json")
# get the tags of the model
self.tags = configuration.get("tags", [])
self._loaded = False