Logo Lanfrica

agbozo1/gh-parliament-ai

Domain:

natural language processing

Record type:

software
Creator:
agb
Host:
This Streamlit RAG-Based application provides an end-to-end pipeline for downloading, processing, embedding, and querying parliamentary debate reports from the Parliament of Ghana. # πŸ›οΈ Ghana Parliamentary Debates QA App This Streamlit application provides an end-to-end pipeline for downloading, processing, embedding, and querying parliamentary debate reports from the Parliament of Ghana. --- ## πŸ“Œ Overview The application enables users to: 1. **Download Parliamentary PDFs** between a range of dates from the official Parliament of Ghana website. 2. **Extract & preprocess** text data from the PDFs. 3. **Train a vector database** using sentence embeddings. 4. **Query** the debate reports in natural language using a Retrieval-Augmented Generation (RAG) approach powered by LangChain and Ollama. --- ## πŸ—‚οΈ Project Structure ```text πŸ“ gh_parliament_ai_app/ β”œβ”€β”€ app.py # Main Streamlit app entry β”œβ”€β”€ pages/ β”‚ β”œβ”€β”€ 1 - Download Briefs.py # Page to download PDFs β”‚ └── 2 - Train Model.py # Page to extract, split, embed and save vector DB └── 3 - Query Briefs.py # Page to run queries on the RAG model β”œβ”€β”€ proceedings/ # Folder where downloaded PDFs are stored β”œβ”€β”€ parliament_faiss_db_allminlm # Saved FAISS vector databases ``` --- ## βš™οΈ Features ### πŸ“₯ Docs Downloader (Page 1) - Select a **start and end date**. - Downloads all available parliamentary brief PDFs between those dates. - Files are saved in the `proceedings/` folder. - If a file already exists, it will be **overwritten**. ### 🧠 Train Model (Page 2) - Reads PDFs from the `proceedings/` folder. - Extracts and splits the text into manageable chunks. - Generates **sentence-level embeddings** using `OllamaEmbeddings` (e.g., MiniLM or LLaMA3). - Saves a local **FAISS vector store** for fast retrieval. ### ❓ Query Debate Reports (Page 3) - Loads the trained vector store. - Accepts user input in natural language. - Retrieves relevant chunks using semantic search. - Uses an LLM to answer questions based on retrieved context. --- ## πŸ› οΈ Tech Stack - **Streamlit** – Interactive web app framework. - **LangChain** – RAG orchestration, embeddings, and …