This project is a lightweight web app for question-answering over PDFs using Retrieval Augmented Generation (RAG). Users upload a PDF, ask questions, and get answers based on the document content via a Hugging Face model.
- Prerequirements
- Project Structure
- Model
- Architecture
- Features
- Installation
- How to get API Access Token
- Usage
- License
or above: Download here
: Sign up here
simple-RAG/
├── static/
│ ├── style.css
│ └── script.js
├── templates/
│ └── index.html
├── .gitignore
├── server.py
├── worker.py
├── .env.example
├── Dockerfile
├── requirements.txt
├── LICENSE
└── README.md
- HuggingFaceTB/SmolLM3-3B (You can use different models)
flowchart TD
A[User #40;Web Browser#41;] -- Prompt --> B[Flask Web Server<br/>#40;server.py#41;]
B --> C[Worker<br/>#40;worker.py#41;]
F[PDF file] -- Store --> D
C --> D[Vector DB<br/>#40;Chroma#41;]
C --> E[LLM]
A -- Upload --> F
D -- Retrieves context --> C
E -- Generates answer --> C
C -- Responds --> B
B -- Returns answer --> A
- Upload and query PDF documents
- RAG-powered chatbot interface
- Uses Hugging Face models
- Local semantic search with Chroma
- Light/dark mode UI
To install this project, open your Terminal and follow these steps:
-
Clone the repository:
$ git clone https://github.com/arthurtran04/simple-RAG.git
-
Change the directory to
simple-RAG:$ cd "$(find . -type d -name "simple-RAG")"
-
Create a Python virtual environment
.venvand install the required dependencies:$ python -m venv .venv source .venv/bin/activate pip install -r requirements.txt -
Set up environment variables:
$ cp .env.example .env
-
Configure your
.envfile:# Hugging Face API Token HF_TOKEN=
1. Go to Hugging Face website, click your avatar and click "Access Tokens"
To start the application, run the server.py file:
$ python server.pyThis application will run locally at http://127.0.0.1:5000:
Upload your PDF file and enter your prompt in the textbox below, and the chatbot will respond:
To stop the application, use Ctrl + C in the Terminal
This project is licensed under the Apache-2.0 License. See the LICENSE file for more details.






