LegalMind AI is an intelligent contract summarization tool for legal professionals. It uses cutting-edge NLP models to generate concise summaries of long legal documents, helping save time and improve comprehension.
- 🔍 AI-Powered Summarization using Transformer models (e.g.
facebook/bart-large-cnn) - ⚡ GPU Acceleration if available, for faster performance
- 📥 Input via file upload, direct text, or sample contract
- 📊 Dynamic summary length tuning for optimal output
- 🧠 Summary metrics: original length, compression ratio, processing time
- 🧾 Analysis history with detailed summaries and full document view
- 💾 SQLite database with content hashing to prevent duplicates
- 🎨 Sleek Streamlit UI with custom CSS and tabbed layout
git clone https://github.com/BaraaHazzaa/legal-analyzer.git
cd legal-analyzerMake sure Python 3.8+ is installed.
pip install -r requirements.txtIf
requirements.txtis missing, create it manually with:
streamlit
transformers
torch
streamlit run app.py- Upload a
.txtcontract file, or paste text manually - Click "Analyze Contract"
- View the AI-generated summary and metrics
- Browse past analyses in the History & Insights tab
legal-analyzer/
├── app.py # Streamlit frontend + app logic
├── model.py # Summarization model loading
├── .gitignore
├── contract_analytics.db # (Ignored) SQLite DB for history
├── model_cache/ # (Ignored) Local HuggingFace cache
├── test_contract.txt # Sample contract text
└── README.md # You're here!
- Uses GPU if available (
torch.cuda.is_available()) - Local caching for models speeds up load time
- Summaries stored in SQLite with content hashing
- PDF and DOCX parsing support
- User authentication & per-user history
- Export summaries as PDF/Word
- Search/filter saved analyses
Baraa Hazzaa
GitHub