A Flask web application that generates professional legal documents using OpenAI's GPT-4 API and ReportLab for PDF generation.
- AI-powered legal document generation
- Multiple document types (NDA, Terms of Service, Privacy Policy, etc.)
- Customization based on business type, industry, and state
- PDF generation and download
- Responsive web interface
- Backend: Python 3.10+, Flask
- AI: OpenAI GPT-4 API
- PDF Generation: ReportLab
- Frontend: HTML, CSS, JavaScript (Vanilla)
- Security: Flask-Limiter for rate limiting, CORS protection
- Clone the repository:
git clone <repository-url>
cd instantlegal-ai
- Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file in the root directory with the following variables:
FLASK_APP=app.py
FLASK_ENV=development
OPENAI_API_KEY=your_openai_api_key_here
SECRET_KEY=your_secret_key_here
- Run the application:
flask run
- Open your browser and navigate to
http://localhost:5000
- Select a document type from the dropdown menu
- Fill in your business details
- Choose protection level and any special clauses
- Click "Generate Document Now"
- Download your generated PDF document
instantlegal-ai/
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── .env # Environment variables (not in repo)
├── .gitignore # Git ignore file
├── README.md # Project documentation
├── static/ # Static files
│ ├── css/ # CSS files
│ ├── js/ # JavaScript files
│ └── documents/ # Generated documents
└── templates/ # HTML templates
└── index.html # Main application template
MIT
This application is for demonstration purposes only. The generated legal documents should be reviewed by a qualified legal professional before use in a real-world context.