M17idd commited on
Commit
fdc7e3f
·
1 Parent(s): 1e7b853

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -575,9 +575,12 @@ if query:
575
  summarized_text = summarize_text_with_kmeans(text_to_summarize)
576
 
577
  # استفاده از پردازش موازی برای افزایش سرعت fuzzy matching
578
- with ThreadPoolExecutor(max_workers=8) as executor:
579
- futures = [executor.submit(compute_similarity, sentence, query, threshold) for sentence in all_sentences]
580
- matched_sentences = [future.result() for future in futures if future.result()]
 
 
 
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: