Move packages
Signed-off-by: András Schmelczer <andras@schmelczer.dev>
This commit is contained in:
parent
cef2e51c67
commit
acbdd96883
1 changed files with 123 additions and 27 deletions
24
good_ai/src/good_ai/good_ai/models/use_model.py
Normal file
24
good_ai/src/good_ai/good_ai/models/use_model.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
from typing import Literal, Union
|
||||
|
||||
from ..core import function_registry
|
||||
from .use_model_plugin import UseModelPlugin
|
||||
|
||||
|
||||
def use_model(
|
||||
key: str, version: Union[int, Literal["latest"]] = None, return_path: bool = False
|
||||
):
|
||||
assert isinstance(version, int) or version == "latest"
|
||||
|
||||
def inner(f):
|
||||
function_registry.add_plugin(
|
||||
f,
|
||||
UseModelPlugin(
|
||||
f,
|
||||
key=key,
|
||||
version=version if isinstance(version, int) else None,
|
||||
return_path=return_path,
|
||||
),
|
||||
)
|
||||
return f
|
||||
|
||||
return inner
|
||||
Loading…
Reference in a new issue