Spaces:
Sleeping
Download README.md from Padmini1/queryvault: direct link, hf CLI and curl.
- Browser
- Download file 6.14 kB
-
https://huggingface.co/spaces/Padmini1/queryvault/resolve/main/README.md
- Command line
-
hf download hf://spaces/Padmini1/queryvault/README.md
-
curl -L -o README.md https://huggingface.co/spaces/Padmini1/queryvault/resolve/main/README.md
A newer version of the Gradio SDK is available: 6.33.0
title: QueryVault
emoji: ๐ฌ
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 5.0.1
python_version: '3.11'
app_file: app.py
pinned: false
license: mit
๐ QueryVault โ PDF Question Answering Bot
Ask questions about any PDF document and get intelligent, context-aware answers powered by Groq API (Llama-3.3 70B Instruct), LangChain RAG, and an ephemeral ChromaDB.
๐ Live Demo: Try QueryVault on Hugging Face Spaces!
๐ง How It Works
QueryVault implements a full Retrieval-Augmented Generation (RAG) pipeline:
ASCII Representation:
PDF Upload
โ
โผ
PyPDFLoader โโโโ loads raw text from all pages
โ
โผ
RecursiveCharacterTextSplitter โโโโ splits into ~1000-char chunks
โ
โผ
HuggingFace Local Embeddings โโโโ converts each chunk to a vector
โ
โผ
ChromaDB โโโโ stores and indexes all vectors in-memory (per PDF)
โ
โผ
User Question โโโบ similarity search โโโบ top-3 relevant chunks retrieved
โ
โผ
Llama-3.3 70B Instruct (ChatGroq) โโโโ reads context + question โ generates answer
โ
โผ
Gradio UI โโโโ displays the answer to the user
๐๏ธ Project Structure
queryvault/
โ
โโโ app.py # Gradio web interface โ run this to start the app
โ
โโโ src/
โ โโโ __init__.py
โ โโโ qabot.py # Full RAG pipeline: loader โ splitter โ embedder โ retriever โ LLM โ chain
โ
โโโ docs/
โ โโโ DECISION_STRUCTURE.md # Full design decisions explained in plain English
โ
โโโ requirements.txt # All Python dependencies
โโโ .env.example # Credential template (rename to .env and fill in)
โโโ .gitignore
โโโ README.md
โ๏ธ Setup & Installation
1. Clone the repository
git clone https://github.com/YOUR_USERNAME/queryvault.git
cd queryvault
2. Create a virtual environment
python -m venv venv
# Windows
venv\Scripts\activate
# macOS / Linux
source venv/bin/activate
3. Install dependencies
pip install -r requirements.txt
4. Add your Groq API credentials
To run this app locally, you need a free API key from Groq:
- Create a file named
.envin the root folder. - Open the
.envfile and add the following lines:
GROQ_API_KEY=your_groq_api_key
How to get a free key:
- Sign up at console.groq.com
- Go to API Keys and generate a new key
5. Run the app
python app.py
Open http://127.0.0.1:7860 in your browser.
๐ฅ๏ธ Usage
- Click Upload PDF and select any PDF document.
- Type your question in the Your Question box.
- Click Get Answer.
- The bot retrieves relevant sections from your document and generates a clear answer.
๐ Sharing & Deployment
Temporary Public Link (The Easiest Way)
Because this app uses Gradio, you don't even need to deploy it to share it with your friends or recruiters!
When you run python app.py on your computer, Gradio automatically generates a temporary public URL (e.g., https://1234abcd.gradio.live).
- Simply copy that
gradio.livelink from your terminal and send it to anyone! - Note: This link only works while the terminal is actively running on your PC.
Permanent Free Deployment (Hugging Face Spaces)
If you want the app to be available 24/7 without keeping your computer on, you can deploy it for free using Hugging Face:
- Go to Hugging Face Spaces and create a free account.
- Click Create new Space.
- Enter a Space name, choose Gradio as the Space SDK, and click Create.
- In the Settings tab of your new Space, go to Variables and secrets. Add your
.envvariable as a Secret (GROQ_API_KEY). - Upload all the files from this repository (except
venvand.env) directly into the "Files" tab of your Space. - The Space will automatically build and launch your app permanently!
๐งฉ Component Decisions
| Component | Choice | Why |
|---|---|---|
| Document Loader | PyPDFLoader |
Handles multi-page PDFs reliably |
| Text Splitter | RecursiveCharacterTextSplitter |
Preserves context at chunk boundaries |
| Embedding Model | HuggingFace all-MiniLM-L6-v2 |
Optimized for semantic similarity; runs locally for free |
| Vector Database | ChromaDB (In-Memory) | Lightweight, completely isolates each PDF upload |
| LLM | Llama-3.3 70B Instruct | State-of-the-art instruction-following; powerful reasoning |
| Orchestration | LangChain | Clean pipeline abstraction, easy to extend |
| UI | Gradio | Zero-config web app, file upload built-in |
๐ Performance (on structured PDFs)
| Metric | Score |
|---|---|
| Exact Match Rate | 97% |
| F1 Score | 0.9862 |
| Semantic Similarity | 0.9936 |
| Avg. Response Time | < 3 seconds |
๐ฎ Future Enhancements
- Support for DOCX and TXT file formats
- Multi-document querying
- Conversation memory (multi-turn chat)
- Voice input / output (accessibility)
- Multilingual support
- Cloud deployment (HuggingFace Spaces / AWS)
- User feedback loop for continuous improvement
๐ Tech Stack
- LangChain โ RAG pipeline orchestration
- Groq โ Lightning-fast LLM inference
- ChromaDB โ Vector database
- Gradio โ Web UI
- PyPDF โ PDF parsing
๐ License
MIT License โ see LICENSE for details.
