File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 1313
1414import archipel_utils as utils
1515import msgpack
16+ import nest_asyncio
1617import websockets
1718
1819log = logging .getLogger (__name__ )
@@ -204,4 +205,12 @@ async def _inference(self, inputs):
204205 await self .__aexit__ (exc_type = None , exc_value = None , traceback = None )
205206 return outputs
206207
208+ try :
209+ loop = asyncio .get_running_loop ()
210+ if loop .is_running ():
211+ # when executed in jupyter notebook or something
212+ nest_asyncio .apply (loop )
213+ except RuntimeError :
214+ pass
215+
207216 return asyncio .run (_inference (self , inputs ))
Original file line number Diff line number Diff line change 2525 "imutils>=0.5.4" ,
2626 "msgpack>=1.0" ,
2727 "numpy>=1.19" ,
28+ "nest-asyncio>=1.5" ,
2829 "rich>=10.13" ,
2930 "websockets>=8.1" ,
3031 "opencv-python==4.6.0.66" ,
You can’t perform that action at this time.
0 commit comments