fix: uploaded file were closed automatically before the model could infer their data

This commit is contained in:
faraphel 2025-01-10 11:05:41 +01:00
parent 639425ad7d
commit b89fafdc96
6 changed files with 62 additions and 12 deletions

View file

@ -104,7 +104,7 @@ class BaseModel(abc.ABC):
Do not call manually, use `unload` instead.
"""
def infer(self, *args, **kwargs) -> typing.Iterator[bytes]:
def infer(self, **kwargs) -> typing.Iterator[bytes]:
"""
Infer our payload through the model within the model manager
:return: the response of the model
@ -114,10 +114,10 @@ class BaseModel(abc.ABC):
self.load()
# model specific inference part
return self._infer(*args, **kwargs)
return self._infer(**kwargs)
@abc.abstractmethod
def _infer(self, *args, **kwargs) -> typing.Iterator[bytes]:
def _infer(self, **kwargs) -> typing.Iterator[bytes]:
"""
Infer our payload through the model
:return: the response of the model