Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions i2_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import archipel_utils as utils
import msgpack
import nest_asyncio
import websockets

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -204,4 +205,12 @@ async def _inference(self, inputs):
await self.__aexit__(exc_type=None, exc_value=None, traceback=None)
return outputs

try:
loop = asyncio.get_running_loop()
if loop.is_running():
# when executed in jupyter notebook or something
nest_asyncio.apply(loop)
except RuntimeError:
pass

return asyncio.run(_inference(self, inputs))
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"imutils>=0.5.4",
"msgpack>=1.0",
"numpy>=1.19",
"nest-asyncio>=1.5",
"rich>=10.13",
"websockets>=8.1",
"opencv-python==4.6.0.66",
Expand Down