How gilgamish-hub/legal-auditor-ai works
Legal Auditor AI is a contract-auditing application: users provide contract text or a PDF, then receive clause classifications, risk levels, highlighted key words, and downloadable reports. Its supporting workflow prepares lawyer-annotated CUAD data, including an “Other” class and contract-level splits, for baseline and LegalBERT training. The graph preserves those documented capabilities. The training module and label-mapping implementation were not excerpted, so their internal relationships are shown only where the README or indexed references support them.
Main entry points: predict.py Document audit · app.py Streamlit interface · preprocess.py Clause preprocessing · processed Train validation test data
Components 18
Audit application
- Streamlit interface
src/app.py - PDF text extraction
src/app.py - Audit reports and dashboard
src/app.py
Clause analysis
- Document audit
src/inference/predict.py - Clause splitting
src/utils/text.py - LegalBERT classifier
src/inference/predict.py - Risk scoring
src/inference/predict.py - Key-word attribution
src/inference/predict.py
Dataset preparation
- CUAD corpus
data/raw/cuad.json - CUAD extraction
src/data/load_cuad.py - Label mapping
src/data/label_mapping.py - Clause preprocessing
src/data/preprocess.py - Dataset orchestration
src/data/build_dataset.py - Train validation test data
data/processed
Model development
- TF-IDF baseline
src/models/baseline.py - LegalBERT fine-tuning
src/models/train_legalbert.py
Other components
- Contract reviewer
- Hugging Face model
Connections 18
- Contract reviewer → Streamlit interface: submits text
README.md - Contract reviewer → PDF text extraction: uploads PDF
README.md - PDF text extraction → Streamlit interface: provides text
src/app.py - Streamlit interface → Document audit: requests audit
src/app.py - Document audit → Clause splitting: splits clauses
src/inference/predict.py - Document audit → LegalBERT classifier: classifies clauses
src/inference/predict.py - Document audit → Risk scoring: scores risk
src/inference/predict.py - Document audit → Key-word attribution: finds key words
src/inference/predict.py - LegalBERT classifier → Hugging Face model: loads model
src/inference/predict.py - Document audit → Streamlit interface: returns results
src/app.py - Streamlit interface → Audit reports and dashboard: renders and exports
src/app.py - CUAD corpus → CUAD extraction: provides annotations
README.md - Dataset orchestration → CUAD extraction: extracts spans
src/data/build_dataset.py - Dataset orchestration → Clause preprocessing: prepares samples
src/data/build_dataset.py - Clause preprocessing → Label mapping: maps labels
src/data/preprocess.py - Clause preprocessing → Train validation test data: writes datasets
src/data/preprocess.py - TF-IDF baseline → Train validation test data: loads datasets
README.md - LegalBERT fine-tuning → Train validation test data: trains on datasets
README.md