We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 188d8af commit c9c8f11Copy full SHA for c9c8f11
1 file changed
i2_client/client.py
@@ -13,6 +13,7 @@
13
14
import archipel_utils as utils
15
import msgpack
16
+import nest_asyncio
17
import websockets
18
19
log = logging.getLogger(__name__)
@@ -204,4 +205,10 @@ async def _inference(self, inputs):
204
205
await self.__aexit__(exc_type=None, exc_value=None, traceback=None)
206
return outputs
207
- return asyncio.run(_inference(self, inputs))
208
+ loop = asyncio.get_running_loop()
209
+ if loop.is_running():
210
+ # when executed in jupyter notebook or something
211
+ nest_asyncio.apply(loop)
212
+ outputs = asyncio.run(_inference(self, inputs))
213
+
214
+ return outputs
0 commit comments