added a lock to avoid two inference at the same time and added consequent support for asynchronous generator based model
This commit is contained in:
parent
c6d779f591
commit
775c78c6cb
4 changed files with 19 additions and 12 deletions
|
@ -1,4 +1,3 @@
|
|||
import json
|
||||
import typing
|
||||
|
||||
|
||||
|
@ -8,5 +7,5 @@ def load(model) -> None:
|
|||
def unload(model) -> None:
|
||||
pass
|
||||
|
||||
def infer(model, file) -> typing.Iterator[bytes]:
|
||||
yield json.dumps({"hello": "world!"}).encode("utf-8")
|
||||
async def infer(model, file) -> typing.AsyncIterator[bytes]:
|
||||
yield await file.read()
|
Loading…
Add table
Add a link
Reference in a new issue