This repository contains two powerful AI-based tools designed for legal assistance and judgment summarization:
- Legal Chatbot – A retrieval-based assistant that answers legal questions using Indian law sources.
- Legal Summarizer – A fine-tuned BART model that compresses lengthy legal judgments into concise summaries.
LegalCompanion/
│
├── Legal_Chatbot/
│ ├── legal_chatbot_final.ipynb # Main chatbot notebook
│ ├── chatbot_utils.py # Helper functions for chatbot
│ └── vector_store/ # FAISS index and ingested docs
│
├── Legal_Summarizer/
│ ├── bartseq2seq.ipynb # BART fine-tuning notebook
│ ├── Legal_summarizer_final.ipynb # Final summarization pipeline
│ └── summarizer_utils.py # Supporting utilities
│
├── requirements.txt # Dependencies
├── LICENSE # MIT License
└── README.md # Project documentation
- Retrieval-Augmented Generation (RAG) using FAISS
- Ingests documents from Indian law: Constitution, IPC, CrPC, etc.
- Answers domain-specific legal questions
- Document-aware legal Q&A (PDF ingestion supported)
- Fine-tuned BART model for legal judgment summarization
- Combines extractive and abstractive techniques
- Trained on d0r1h/ILC
- Clone the repository:
git clone https://github.com/Anshul-ydv/Legal-ai.git
cd LegalCompanion- Install dependencies:
pip install -r requirements.txt- Navigate to the
Legal_Chatbot/folder. - Open and run:
legal_chatbot_final.ipynb- Follow the steps to load your corpus, generate embeddings, and interact with the assistant.
- Go to
Legal_Summarizer/. - Open and run:
Legal_summarizer_final.ipynb- Provide legal text input and get summarized outputs using the fine-tuned model.
- Summarizer Dataset: d0r1h/ILC
- Chatbot Corpus: QA pairs and legal documents from Indian legal sources (manually or automatically curated)
- Python · PyTorch · HuggingFace Transformers
- FAISS · Google Colab · NLTK · Sklearn
- Optional UI: Streamlit or Gradio
- Add multilingual query support (Hindi, Bengali, etc.)
- Deploy as a web app using FastAPI + Streamlit
- Add support for OCR and audio-based legal queries
- Visual analytics dashboard for legal search trends
- Indian Legal Corpus – d0r1h/ILC
- HuggingFace Ecosystem (Transformers, Datasets)
- FAISS by Meta AI
- OpenAI APIs for comparison and benchmarking
This project is open-sourced under the MIT License.
“This AI has read more Indian laws than most lawyers.”