The Legal Document Analyzer is a FastAPI application designed to analyze legal documents using a fine-tuned BERT model. The application provides endpoints for uploading PDF files and analyzing their content. It also includes a web interface for interacting with the application.
The project requires the following dependencies:
git clone https://github.com/harshitIIITD/legal-doc-analyzer.git
cd legal-doc-analyzer
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
pip install -r requirements.txt
mlflow server --backend-store-uri sqlite:///mlflow.db --default-artifact-root ./mlruns
uvicorn app.main:app --reload
http://127.0.0.1:8000 to access the web interface.Endpoint: POST /analyze
Upload a PDF document to analyze its content.
curl -X POST "http://127.0.0.1:8000/analyze" -F "file=@path/to/document.pdf"
{
"filename": "document.pdf",
"classification": [0, 1, 0, 1],
"text_preview": "Extracted text preview...",
"confidence": 0.95,
"model_version": "1234567890abcdef",
"timestamp": "2023-01-01T12:00:00"
}
Endpoint: POST /ask
Ask a question about the analyzed document.
curl -X POST "http://127.0.0.1:8000/ask" -H "Content-Type: application/json" -d '{"question": "What is the main clause?"}'
{
"answer": "The main clause is..."
}


app/main.py: Main FastAPI applicationapp/routes/questions.py: Question answering endpointapp/models/legal_bert: Fine-tuned BERT modelapp/templates/index.html: Web interface templatetests: Test cases for the applicationdata/dvc.yaml: Data version control configurationThe Legal Document Analyzer is a FastAPI application designed to analyze legal documents using a fine-tuned BERT model. The application provides endpoints for uploading PDF files and analyzing their content. It also includes a web interface for interacting with the application.
The project requires the following dependencies:
git clone https://github.com/harshitIIITD/legal-doc-analyzer.git
cd legal-doc-analyzer
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
pip install -r requirements.txt
mlflow server --backend-store-uri sqlite:///mlflow.db --default-artifact-root ./mlruns
uvicorn app.main:app --reload
http://127.0.0.1:8000 to access the web interface.Endpoint: POST /analyze
Upload a PDF document to analyze its content.
curl -X POST "http://127.0.0.1:8000/analyze" -F "file=@path/to/document.pdf"
{
"filename": "document.pdf",
"classification": [0, 1, 0, 1],
"text_preview": "Extracted text preview...",
"confidence": 0.95,
"model_version": "1234567890abcdef",
"timestamp": "2023-01-01T12:00:00"
}
Endpoint: POST /ask
Ask a question about the analyzed document.
curl -X POST "http://127.0.0.1:8000/ask" -H "Content-Type: application/json" -d '{"question": "What is the main clause?"}'
{
"answer": "The main clause is..."
}


app/main.py: Main FastAPI applicationapp/routes/questions.py: Question answering endpointapp/models/legal_bert: Fine-tuned BERT modelapp/templates/index.html: Web interface templatetests: Test cases for the applicationdata/dvc.yaml: Data version control configuration