CoolFace
Apppublic

ajinkya45/SIMPLE-RAG-PDF

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

๐Ÿง  RAG-based PDF QA App

This is a simple Retrieval-Augmented Generation (RAG) application that allows you to upload a PDF, retrieve the most relevant content using semantic similarity, and generate answers using a lightweight LLM. It's built using Sentence Transformers, Qdrant vector store, and a Streamlit UI.


๐Ÿ“˜ What is RAG?

Retrieval-Augmented Generation (RAG) is an architecture that combines information retrieval and natural language generation. Instead of generating answers purely from a model's training data, RAG retrieves relevant documents from a knowledge base and feeds them into the language model to ground the answer in actual facts.


๐Ÿงฉ What is an Embedding?

An embedding is a numerical representation of data (like text) in a high-dimensional vector space. Similar meanings result in similar vectors. This is crucial for finding semantically relevant documents using distance-based search.


๐Ÿ—ƒ๏ธ What is a Vector Store / Vector Database?

A vector database stores these high-dimensional embeddings and allows for efficient similarity searches using methods like cosine similarity or Euclidean distance. It's the backbone of retrieval in RAG systems.


๐Ÿ› ๏ธ What We Used

ComponentTool/Library
Embedding Modelall-MiniLM-L6-v2 from sentence-transformers
Vector StoreQdrant (in-memory instance)
PDF Parsingpdfplumber
LLMHuggingFace Pipeline (distil model)
UIStreamlit
LanguagePython

๐Ÿ–ผ๏ธ Example Result

Here is an example of how the result looks after querying the PDF:

[image]


๐Ÿš€ How to Run Locally

1. Clone the repository

bash
git clone https://huggingface.co/spaces/ajinkya45/SIMPLE-RAG-PDF
cd SIMPLE-RAG-PDF

2. Create and activate a virtual environment

bash
python -m venv rag_env
source rag_env/bin/activate   # On Windows use: rag_env\Scripts\activate

3. Install required dependencies

bash
pip install -r requirements.txt

4. Start the Streamlit app

bash
streamlit run app.py