kebos-ai / async_utils.py
HARISH20205's picture
first
f3352b5
raw
history blame contribute delete
364 Bytes
import asyncio
from url_process import extract_url_features
async def async_extract_features(url):
loop = asyncio.get_event_loop()
return await loop.run_in_executor(None, extract_url_features, url)
async def process_urls_async(urls):
tasks = [async_extract_features(url) for url in urls]
results = await asyncio.gather(*tasks)
return results