Spaces:
Running
Running
| import asyncio | |
| def async_tasks(*tasks): | |
| async def gather(*t): | |
| t = [await _ for _ in t] | |
| return await asyncio.gather(*t) | |
| loop = asyncio.new_event_loop() | |
| results = loop.run_until_complete(gather(*tasks)) | |
| loop.stop() | |
| loop.close() | |
| return results | |