A full-stack web application for analyzing legal contracts using local LLMs. Contract Guard helps users understand their contracts by breaking them down into clauses, classifying them, and providing plain English explanations.
- Upload and analyze legal contracts (PDF, DOCX, TXT)
- Extract and classify individual clauses
- Risk level assessment
- Plain English explanations
- Interactive dashboard with visualizations
- Dark mode support
- Completely offline operation
- No API keys required
- Python 3.8+
- Node.js 16+
- npm or yarn
- CUDA-capable GPU (recommended for better performance)
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install Python dependencies:
pip install -r requirements.txt- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install- Activate the virtual environment (if not already activated):
source venv/bin/activate # On Windows: venv\Scripts\activate- Start the Flask server:
python backend/app.pyThe backend will be available at http://localhost:5000
- In a new terminal, navigate to the frontend directory:
cd frontend- Start the development server:
npm startThe frontend will be available at http://localhost:3000
- Open your browser and navigate to
http://localhost:3000 - Drag and drop a contract file (PDF, DOCX, or TXT) or click to select one
- Wait for the analysis to complete
- View the results in the interactive dashboard
- Review individual clauses with their classifications and explanations
- Flask web framework
- HuggingFace Transformers for local LLM inference
- PDF and DOCX parsing
- Clause extraction and classification
- React.js
- Tailwind CSS for styling
- Chart.js for visualizations
- Framer Motion for animations
- Dark mode support
- For faster inference, use a CUDA-capable GPU
- The application uses FLAN-T5-XL by default, but you can modify the model in
backend/models/classify_llm.py - For better performance on CPU, consider using quantized models
MIT License