CoolFace
Apppublic

Subhakanta156/Odisha-Disaster-Chatbot

sourceHugging Facemitupdated 11mo agoView on Hugging Face
2likes
App README

title: "Odisha Disaster RAG Chatbot" emoji: "🌊" colorFrom: green colorTo: yellow sdk: docker app_file: app.py pinned: false license: mit ---

πŸŒ€ Odisha Disaster Management RAG Chatbot

πŸ“Œ Overview

Odisha faces recurring disasters every year such as floods, cyclones, and droughts. While the state has a strong disaster management authority (OSDMA), information is often scattered across reports, research papers, and government documents.

This project builds a Retrieval-Augmented Generation (RAG) based chatbot that provides citizens, researchers, and policymakers with clear, reliable, and contextual answers related to Odisha’s disaster management practices.


✨ Features

  • β€”Handles 132 PDFs and 12 text files (OSDMA, IMD, NDMA, research papers).
  • β€”Preprocessing pipeline: PDF/text extraction, cleaning, normalization, chunking.
  • β€”Embeddings with sentence-transformers/all-MiniLM-L6-v2.
  • β€”FAISS Vector Database for fast and efficient retrieval.
  • β€”RAG pipeline:
  • β€”User query β†’ query structuring (handles poor English, spelling issues).
  • β€”Retrieve relevant chunks from FAISS.
  • β€”If no relevant results β†’ no LLM call (saves cost).
  • β€”If relevant β†’ LLM generates structured, contextual answers.
  • β€”Prompt engineering for better accuracy and reduced hallucinations.
  • β€”Backend: FastAPI.
  • β€”Frontend: HTML, CSS, JS chatbot interface.

πŸ—οΈ Architecture

User Query β†’ Query Structuring β†’ FAISS Retriever β†’ Relevant Chunks β†’ LLM β†’ Answer

πŸ› οΈ Tech Stack

  • β€”Python (data handling & backend)
  • β€”PyPDF, TextLoader β†’ PDF/Text extraction
  • β€”FAISS β†’ Vector database
  • β€”HuggingFace Sentence Transformers β†’ Embeddings
  • β€”FastAPI β†’ Backend API
  • β€”HTML, CSS, JavaScript β†’ Frontend chatbot UI
  • β€”LLM (OpenAI / HuggingFace) β†’ Answer generation

βš™οΈ Installation

1. Clone the repository

bash
git clone https://github.com/subhakanta156/odisha-disaster-knowledge-assistant.git

2. Create virtual environment & install dependencies

bash
python -m venv venv
source venv/bin/activate   # Linux/Mac
venv\Scripts\activate      # Windows

pip install -r requirements.txt

3. Prepare the data

  • β€”Place all PDFs/text files inside the data/ folder.
  • β€”Run preprocessing & embedding script:
bash
python scripts/build_vector_store.py

4. Run the FastAPI backend

bash
uvicorn app.main:app --reload

5. Open the frontend

  • β€”Open frontend/index.html in your browser.

πŸš€ Usage

Ask questions like:

  • β€”β€œHow does Odisha’s disaster proneness compare with other Indian states?”
  • β€”β€œProvide details of relief funds sanctioned for Odisha during the 1999 Super Cyclone.”
  • β€”β€œWhich Odisha agency is primarily responsible for issuing cyclone alerts?”
  • β€”β€œExplain the key steps taken by the Odisha government if lives are lost in a disaster?”

The system retrieves relevant chunks from reports and generates reliable, structured answers.


πŸ“Š Optimizations

  • β€”Added query filtering β†’ No LLM call if retrieval fails (reduces cost).
  • β€”Handled poor English queries via query restructuring.
  • β€”Improved prompt engineering to minimize hallucinations.

πŸ“Œ Future Improvements

  • β€”Add multilingual support (Odia/Hindi queries).
  • β€”Deploy on cloud (AWS/GCP/Azure) with Docker.
  • β€”Use advanced embeddings (e.g., all-mpnet-base-v2) for higher accuracy.
  • β€”Add real-time updates (e.g., cyclone alerts).

πŸ‘¨β€πŸ’» Author

Subhakanta Rath

MSc AI & ML @ IIIT Lucknow

Passionate about AI/ML, Data Engineering