diff options
Diffstat (limited to 'app.py')
-rw-r--r-- | app.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app.py b/app.py index 6c39b58..c60a4bd 100644 --- a/app.py +++ b/app.py @@ -11,6 +11,7 @@ from functools import cache import feedparser import multiprocessing +mp = multiprocessing.get_context('spawn') parse = lambda l: bs(urllib.request.urlopen(l), 'html.parser') @cache @@ -32,7 +33,7 @@ def get_links(category="cs"): def get_probability_distribution(topic): links = get_links(topic) x = [0, len(links)//2, round(len(links)//1.5), len(links)-2] - with multiprocessing.Pool(processes=5) as pool: + with mp.Pool(processes=5) as pool: ts = pool.map(total, [links[x] for x in x]+[links[-1]]) y = ts[:-1] ly = np.log(y) |