File size: 603 Bytes
81b0599
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import re

used_libs = {
    "transformers", "torch", "sentencepiece", "pdfplumber",
    "python-docx", "docx2txt", "langdetect", "fpdf", "gradio"
}

with open("requirements.txt", "r", encoding="utf-8") as f:
    lines = f.readlines()

cleaned = []
for line in lines:
    pkg = re.split(r"[=<>]", line.strip())[0]
    if pkg in used_libs:
        cleaned.append(line)
    else:
        print(f"🧹 Удалено неиспользуемое: {pkg}")

with open("requirements.txt", "w", encoding="utf-8") as f:
    f.writelines(cleaned)

print("✅ requirements.txt очищен и обновлён.")