Skip to content

imandal98/nyaya-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nyaya Path: Your Intelligent Legal Guide For Step-by-step action

Legal information + guided next steps assistant for the Bharatiya Nyaya Sanhita (BNS) — ask a question (e.g., theft/fraud/property dispute) and get:

  • a category-specific checklist of steps
  • an optional FIR draft (for certain categories)
  • relevant BNS section excerpts retrieved via Databricks Vector Search

Not legal advice. This app provides general information only — consult a qualified lawyer for your specific situation.

How it works

Question (chat)
  → Model classifies case as types (theft / fraud / property_dispute / general)
  → For legal query:
      → shows actionable steps
      → shows relevant BNS section
      → generate FIR draft (details provided by user)
  → If non-legal/general:
      → gives proper explaination for legal decision making
  → (optional) download FIR as PDF

Documentation

Document Audience What it covers
README (this file) Users / developers What Nyaya Path is, how it works, how to run it

Quick start

For users

  1. Open the app(https://nyaya-path-7474652446860732.aws.databricksapps.com/).
  2. Enter your details in the sidebar (Name, Police Station, Incident Date).
  3. Ask a question like:
    • “My bag is stolen what to do?”
    • “What is fraud?”
    • “Property dispute steps”
  4. If applicable, download the generated FIR PDF.

For developers

This repo is designed to run as a Databricks App (https://nyaya-path-7474652446860732.aws.databricksapps.com/) and uses:

  • a Databricks model serving endpoint named nyaya-path
  • a Databricks Vector Search index at bns-endpoint / workspace.default.bns_index

In app/app.py, these are currently configured as:

  • DATABRICKS_HOST = "Your_Databricks_API_ID"
  • ENDPOINT_NAME = "nyaya-path"
  • Vector Search index: ("bns-endpoint", "workspace.default.bns_index")

Note: app/app.py currently contains a hard-coded token placeholder. For production, you should move secrets to Databricks Secrets / environment variables.

Deploy as a Databricks App

  1. Create a Databricks App and connect this GitHub repository.
  2. Ensure the app runs from the app/ directory (Databricks Apps entry uses app/app.yaml).
  3. Install dependencies from app/requirements.txt.

app/app.yaml runs:

  • streamlit run app.py

Required Databricks resources

  • A Databricks model serving endpoint:
    • Name: nyaya-path
  • A Databricks Vector Search endpoint + index:
    • Endpoint: bns-endpoint
    • Index: workspace.default.bns_index
    • Expected columns retrieved by the app: content, section, section__name

Local development

  1. Install dependencies (local Streamlit app dependencies live under app/requirements.txt):
pip install -r app/requirements.txt
  1. Run the app:
cd app
streamlit run app.py

If you want local development to use environment variables instead of hard-coded values, update app/app.py to read DATABRICKS_HOST / DATABRICKS_TOKEN from env.

Repository layout

Path Purpose
app/app.py Streamlit app (case classification + steps + FIR generation + Vector Search retrieval)
app/app.yaml Databricks Apps entry point (runs Streamlit)
app/requirements.txt Streamlit runtime dependencies (Databricks Vector Search + reportlab)
data/bns.csv BNS source dataset (used to build the vector index externally / via notebooks)
notebooks/NyayaPath.ipynb Notebook(s) for data/index work (project experimentation)
demo/demo.ipynb Demo notebook
.env.example Example env file for local dev (not currently wired into app/app.py)

Testing

No automated test suite is included in the repository currently.

Technology stack

Component Technology
App framework Streamlit
LLM Databricks model serving endpoint (nyaya-path) invoked via REST
Vector search Databricks VectorSearchClient (databricks-vectorsearch)
PDF generation reportlab
Data CSV (data/bns.csv)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors