An AI-powered tool for automatic contract analysis, extracting key clauses, highlighting risks, and streamlining legal document review.
- Extracts key legal clauses (salaries, penalties, fees, liability, dispute resolution, etc.).
- Uses OpenAI GPT-4 to identify risky clauses.
- Highlights text physically in the PDF using an orange marker.
- Processes PDFs page by page to avoid API limits.
git clone https://github.com/juliuspleunes4/legallens.git
cd legallens
pip install -r requirements.txt
Create a .env
file in the root directory with the following text:
OPENAI_API_KEY=YOUR_API_KEY_HERE
- Place the PDF file you want to analyze in the root directory.
- Name it
input.pdf
. - Run the script:
python main.py
- The output PDF with highlighted clauses will be saved as
legallens.pdf
.
- The script will automatically switch to
gpt-3.5-turbo
ifgpt-4
exceeds its token limit. - If API calls still fail, try reducing the PDF size or splitting it into smaller sections.
- Ensure your PDF contains selectable text rather than scanned images.
- Run
pip install -r requirements.txt
again to ensure all necessary packages are installed.
This project is licensed under the MIT License. See LICENSE
for details.
Developed by Julius Pleunes
GitHub: juliuspleunes4
🚀 Happy Contract Scanning!