Spaces:
Sleeping
title: DocuChat_AI
emoji: π
colorFrom: blue
colorTo: indigo
sdk: streamlit
sdk_version: 1.58.0
app_file: app.py
python_version: '3.10'
pinned: false
license: mit
DocuChat_AI is a high-end AI document chatbot that lets users upload documents, generate summaries, extract insights, and ask grounded questions with source citations.
π Live Application
Try the app here:
π Launch DocuChat_AI on Hugging Face
DocuChat_AI is designed for students, analysts, recruiters, researchers, founders, and professionals who need to understand long documents quickly without manually reading every page.
πΌοΈ Application Screenshots
Add your screenshots inside the
assets/folder using the exact filenames below. GitHub will automatically render them in this README.
1. Premium Home Workspace
2. Document Processing and Indexing
3. Chat with Source Citations
4. Summary and Analysis Tools
π Project Overview
Most professionals deal with long PDFs, reports, resumes, policy documents, contracts, research papers, business notes, and technical files. Reading everything manually takes time, and generic chatbots can hallucinate when they are not grounded in the source document.
DocuChat_AI solves this using Retrieval-Augmented Generation (RAG).
The app extracts text from uploaded documents, splits it into searchable chunks, converts those chunks into embeddings, stores them in a FAISS vector index, retrieves the most relevant context for each question, and generates answers using an LLM while keeping responses grounded in the uploaded content.
β¨ Key Features
| Feature | Description |
|---|---|
| π Multi-document upload | Supports PDF, DOCX, and TXT files |
| π§ RAG-based Q&A | Ask natural-language questions about uploaded documents |
| π Smart summaries | Generate executive summaries, study notes, email briefs, and key takeaways |
| π Source citations | View retrieved document chunks used to answer each question |
| π§© Workflow tabs | Chat, Summaries, Extract, Analyze, and Deliverables |
| β‘ Quick action buttons | One-click prompts for risks, decisions, action items, FAQs, and presentation outlines |
| π Index stats | Track processed files, pages, chunks, and processing time |
| π§Ύ Document classification | LLM-based classification into Research Paper, Contract, CV, Invoice, Policy, Report, or Other |
| 𧬠Entity extraction | Extract people, organizations, dates, money values, and locations |
| β οΈ Risk detection | Surface legal risks, missing information, deadlines, and action items |
| π RAG quality metrics | Show retrieved chunks, confidence score, citation coverage, and context usage |
| π§ͺ Evaluation dashboard | Upload labeled test questions and score correctness, faithfulness, and citation coverage |
| π OCR-ready processing | Optional scanned PDF OCR support for Docker deployments |
| π Optional authentication | Protect demos with an APP_PASSWORD environment secret |
| π¬ Chat history | Maintains conversation context during the active session |
| β¬οΈ Export support | Export chat history as Markdown |
| π Secure key input | Uses Hugging Face Secrets, environment variables, or password input |
π§ What Users Can Do
- Upload a long PDF and ask: "What are the main risks in this document?"
- Turn a document into an executive summary
- Extract names, dates, metrics, definitions, and action items
- Generate meeting notes, FAQs, email briefs, and presentation outlines
- Ask follow-up questions using conversation history
- Inspect citations to understand where the answer came from
ποΈ RAG Architecture
Pipeline Flow
- Document Upload - User uploads PDF, DOCX, or TXT files.
- Text Extraction - The app extracts readable text using document loaders.
- Chunking - Text is split into manageable chunks with overlap.
- Embedding Generation - Chunks are converted into vector embeddings.
- Vector Search - FAISS retrieves the most relevant chunks for each query.
- LLM Generation - Groq-powered models generate answers using retrieved context.
- Citation Display - The app shows source previews used for the answer.
π οΈ Tech Stack
| Layer | Tools |
|---|---|
| Frontend | Streamlit |
| LLM | Groq API |
| RAG Framework | LangChain |
| Vector Database | FAISS |
| Embeddings | Hugging Face Sentence Transformers |
| Document Loading | PyPDF, DOCX2TXT, LangChain loaders |
| Text Splitting | LangChain text splitters + tiktoken |
| Deployment | Hugging Face Spaces |
| Language | Python |
π Repository Structure
DocuChat_AI/
β
βββ app.py # Main Streamlit application
βββ README.md # Project documentation
βββ requirements.txt # Python dependencies
βββ runtime.txt # Python runtime version for Hugging Face
βββ Dockerfile # Optional container deployment file
βββ DEPLOYMENT.md # Deployment, auth, OCR, and evaluation guide
βββ eval_sample.csv # Sample labeled evaluation file
βββ LICENSE # MIT License
βββ .gitignore # Local files and secrets ignored by Git
βββ .gitattributes # Hugging Face / Git file handling
β
βββ assets/
βββ app_home.png # Home UI screenshot
βββ document_processing.png # Upload and processing screenshot
βββ chat_with_sources.png # Chat answer and citations screenshot
βββ summary_tools.png # Summary / analysis tools screenshot
βοΈ Local Setup
1. Clone the Repository
git clone https://github.com/dineshbarri/DocuChat_AI.git
cd DocuChat_AI
2. Create a Virtual Environment
python -m venv .venv
Activate it:
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate
3. Install Dependencies
pip install -r requirements.txt
4. Add Your Groq API Key
Create a .env file:
GROQ_API_KEY=your_groq_api_key_here
You can create a Groq API key from:
π https://console.groq.com/
5. Run the App
streamlit run app.py
Open the local URL shown in your terminal.
π How to Get a Groq API Key
- Go to Groq Console
- Sign in or create an account
- Open API Keys
- Create a new API key
- Copy the key
- Paste it into the app sidebar or save it in
.env
For Hugging Face Spaces, add it as a secret:
GROQ_API_KEY = your_key_here
π’ Hugging Face Deployment
- Create a new Hugging Face Space.
- Choose Streamlit as the SDK.
- Upload:
app.pyREADME.mdrequirements.txtruntime.txt.gitattributesassets/
- Add
GROQ_API_KEYin Settings -> Secrets. - Optional: add
APP_PASSWORDin Settings -> Secrets to protect the app. - Restart the Space after dependency changes.
For scanned PDF OCR, use the included Dockerfile because OCR needs the Tesseract system binary. Normal Streamlit SDK Spaces may not include it.
See DEPLOYMENT.md for the full deployment guide.
π‘ Example Questions
Try these after uploading and processing a document:
Summarize this document in 6 crisp bullet points.
What are the key risks, warnings, or limitations?
Extract all names, dates, numbers, and important terms.
Create an action-item checklist from this document.
Explain this document like I am new to the topic.
Create a presentation outline from this document.
π Privacy and Security
- Uploaded files are processed through temporary files.
- The app does not intentionally store user documents.
- The FAISS index and chat history live inside the active Streamlit session.
- API keys should be stored in environment variables or Hugging Face Secrets.
- Avoid uploading highly confidential documents to public demo environments.
β οΈ Limitations
- Scanned PDF OCR requires optional OCR dependencies and works best in Docker mode.
- Very large documents may be limited by CPU and memory on free hosting.
- Complex tables may not extract perfectly from PDFs.
- LLM answers should be reviewed for critical legal, medical, financial, or compliance use cases.
- Citation quality depends on document extraction and retrieval quality.
π Future Improvements
- Multi-document comparison mode
- Persistent user workspaces
- Better page-level citation highlighting
- CSV, Excel, PPTX, and web page support
- Reranking for improved retrieval accuracy
- Authentication and private document libraries
- Downloadable summary reports
- Evaluation dashboard for retrieval quality
π§βπ» Author
β Support
If you found this project useful, consider giving it a star on GitHub. It helps the project reach more developers, recruiters, and AI builders.