Update app.py
Browse files
app.py
CHANGED
@@ -575,9 +575,12 @@ if query:
|
|
575 |
summarized_text = summarize_text_with_kmeans(text_to_summarize)
|
576 |
|
577 |
# استفاده از پردازش موازی برای افزایش سرعت fuzzy matching
|
578 |
-
|
579 |
-
|
580 |
-
|
|
|
|
|
|
|
581 |
|
582 |
# فیلتر کردن جملات بر اساس کلمات کلیدی
|
583 |
if matched_sentences:
|
|
|
575 |
summarized_text = summarize_text_with_kmeans(text_to_summarize)
|
576 |
|
577 |
# استفاده از پردازش موازی برای افزایش سرعت fuzzy matching
|
578 |
+
max_workers = os.cpu_count()
|
579 |
+
|
580 |
+
# پردازش موازی با استفاده از تعداد هستهها
|
581 |
+
with ThreadPoolExecutor(max_workers=max_workers) as executor:
|
582 |
+
futures = [executor.submit(compute_similarity, sentence, query, threshold) for sentence in all_sentences]
|
583 |
+
matched_sentences = [future.result() for future in futures if future.result()]
|
584 |
|
585 |
# فیلتر کردن جملات بر اساس کلمات کلیدی
|
586 |
if matched_sentences:
|