eroha-agentapi / verify_requirements.py
Yermek68's picture
Create verify_requirements.py
81b0599 verified
raw
history blame
603 Bytes
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 очищен и обновлён.")