LegalEase is a Streamlit-based AI legal assistant for Indian law. It helps users understand legal questions by retrieving relevant case-law context, mapping IPC sections to BNS sections, and surfacing relevant government schemes in a chat interfaces.
- Answers legal queries in English or Hinglish.
- Retrieves relevant text from
case_data.csvusing TF-IDF + cosine similarity. - Detects IPC sections from the retrieved context and looks up the matching BNS section from
mapping.csv. - Suggests relevant government schemes when the user query matches legal aid, victim support, women safety, cybercrime, or other assistance topics.
flowchart TD
U[User] --> S[Streamlit UI: app.py]
S --> B[backend.py]
B --> R[TF-IDF Search over case_data.csv]
R --> C[Relevant legal context]
B --> M[IPC ↔ BNS mapping.csv]
B --> G[Government schemes matcher]
B --> L[Sarvam chat completion API]
L --> B
B --> S
S --> U
app.pyrenders the chat UI in Streamlit and sends user prompts to the backend.backend.pybuilds the legal response.case_data.csvis searched with TF-IDF and cosine similarity to find relevant legal text.mapping.csvis used to translate IPC sections into BNS sections.- Sarvam API generates the final natural-language reply using the retrieved context.
python -m venv .venv
source .venv/bin/activateOn Windows:
.venv\Scripts\activatepip install -r requirements.txtapp.pybackend.pyrequirements.txtcase_data.csvmapping.csv
streamlit run app.py-
Open the app in your browser after running Streamlit.
-
Try one of the sample prompts on the home screen, such as:
What is the punishment for theft?Domestic violence ke liye kya section hai?Explain dowry laws in IndiaMujhe arrest kiya bina warrant, kya karoon?
-
Watch the app retrieve legal context, map IPC to BNS, and generate a response.
-
Use the Dark Mode toggle in the sidebar to switch themes.
-
Click Start New Conversation to clear the chat and begin again.
- The app expects a working Sarvam API connection in
backend.py. - The legal responses are based on the uploaded dataset and mapping file, so the quality of
case_data.csvandmapping.csvdirectly affects the output. - This project is designed for educational and hackathon use.
.
├── app.py
├── backend.py
├── requirements.txt
├── case_data.csv
├── mapping.csv
└── README.md