docqnatool is a document Q&A assistant built with Streamlit. Upload PDF, DOCX, or TXT files, and ask questions about their content. The tool extracts and indexes text from your documents (including OCR for scanned images), then uses a Groq-hosted LLaMA model to answer your questions with relevant context.
Try the hosted version: docqnatool.streamlit.app
- Uploaded documents are parsed and text is extracted (with optional OCR via Tesseract).
- Text is split into chunks and embedded using a TF-IDF vectorizer.
- Chunks are stored in a FAISS vector index for fast similarity search.
- When you ask a question, the top matching chunks are retrieved and passed as context to
llama-3.3-70b-versatilevia the Groq API. - The model returns an answer grounded in your document content.
- Supports PDF, DOCX, and TXT file formats
- OCR support via Tesseract for scanned images embedded in documents
- Duplicate file detection using MD5 hashing
- Chat-style interface with message history
- Per-session file stats (file count, word count, total size)
- Python 3.11+
- Tesseract OCR installed on your system
- A Groq API key
1. Clone the repository
git clone https://github.com/crimsonKn1ght/docqnatool.git
cd docqnatool2. Install system dependencies
On Debian/Ubuntu:
sudo apt-get install $(cat packages.txt)On macOS (Homebrew):
brew install tesseract tesseract-lang3. Install Python dependencies
pip install -r requirements.txt4. Set your Groq API key
export GROQ_API_KEY=your_key_hereOr create a .env file in the project root:
GROQ_API_KEY=your_key_here
streamlit run app.pyThen open http://localhost:8501 in your browser.
- Use the sidebar to upload one or more documents (PDF, DOCX, or TXT).
- Toggle OCR on or off depending on whether your documents contain scanned images.
- Once processing is complete, type your question in the chat box.
- Use "Clear All Documents" in the sidebar to reset the session.
The following values can be changed at the top of app.py under the CONSTANTS section:
| Constant | Default | Description |
|---|---|---|
LLM_MODEL_NAME |
llama-3.3-70b-versatile |
Groq model to use for answering |
LLM_TEMPERATURE |
0 |
Model temperature (0 = deterministic) |
CHUNK_SIZE |
1000 |
Characters per document chunk |
CHUNK_OVERLAP |
200 |
Overlap between consecutive chunks |
SIMILARITY_TOP_K |
5 |
Number of chunks retrieved per question |
A .devcontainer config is included for use with VS Code or GitHub Codespaces. It targets Python 3.11, installs all dependencies automatically, and exposes port 8501.
MIT. See LICENSE for details.