Yermek68 commited on
Commit
81b0599
·
verified ·
1 Parent(s): 91ad711

Create verify_requirements.py

Browse files
Files changed (1) hide show
  1. verify_requirements.py +22 -0
verify_requirements.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+
3
+ used_libs = {
4
+ "transformers", "torch", "sentencepiece", "pdfplumber",
5
+ "python-docx", "docx2txt", "langdetect", "fpdf", "gradio"
6
+ }
7
+
8
+ with open("requirements.txt", "r", encoding="utf-8") as f:
9
+ lines = f.readlines()
10
+
11
+ cleaned = []
12
+ for line in lines:
13
+ pkg = re.split(r"[=<>]", line.strip())[0]
14
+ if pkg in used_libs:
15
+ cleaned.append(line)
16
+ else:
17
+ print(f"🧹 Удалено неиспользуемое: {pkg}")
18
+
19
+ with open("requirements.txt", "w", encoding="utf-8") as f:
20
+ f.writelines(cleaned)
21
+
22
+ print("✅ requirements.txt очищен и обновлён.")