Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -20,9 +20,11 @@ async def scrape_wikipedia(url):
|
|
20 |
|
21 |
async def scrape_urls(urls):
|
22 |
tasks = []
|
|
|
|
|
23 |
async with concurrent.futures.ThreadPoolExecutor(max_workers=len(urls)) as executor:
|
24 |
for url in urls:
|
25 |
-
tasks.append(
|
26 |
await asyncio.gather(*tasks)
|
27 |
return tasks
|
28 |
|
|
|
20 |
|
21 |
async def scrape_urls(urls):
|
22 |
tasks = []
|
23 |
+
loop = asyncio.new_event_loop()
|
24 |
+
asyncio.set_event_loop(loop)
|
25 |
async with concurrent.futures.ThreadPoolExecutor(max_workers=len(urls)) as executor:
|
26 |
for url in urls:
|
27 |
+
tasks.append(loop.run_in_executor(executor, scrape_wikipedia, url))
|
28 |
await asyncio.gather(*tasks)
|
29 |
return tasks
|
30 |
|