--- 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 ---

Typing SVG

Live Demo GitHub Repository MIT License

**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](https://huggingface.co/spaces/dineshb/DocuChat_AI) 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 DocuChat_AI home workspace ### 2. Document Processing and Indexing Document upload and processing workflow ### 3. Chat with Source Citations Document question answering with citations ### 4. Summary and Analysis Tools Summary and analysis tabs
--- ## ๐Ÿ“Œ 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
DocuChat AI RAG architecture diagram
### Pipeline Flow 1. **Document Upload** - User uploads PDF, DOCX, or TXT files. 2. **Text Extraction** - The app extracts readable text using document loaders. 3. **Chunking** - Text is split into manageable chunks with overlap. 4. **Embedding Generation** - Chunks are converted into vector embeddings. 5. **Vector Search** - FAISS retrieves the most relevant chunks for each query. 6. **LLM Generation** - Groq-powered models generate answers using retrieved context. 7. **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 ```text 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 ```bash git clone https://github.com/dineshbarri/DocuChat_AI.git cd DocuChat_AI ``` ### 2. Create a Virtual Environment ```bash python -m venv .venv ``` Activate it: ```bash # Windows .venv\Scripts\activate # macOS / Linux source .venv/bin/activate ``` ### 3. Install Dependencies ```bash pip install -r requirements.txt ``` ### 4. Add Your Groq API Key Create a `.env` file: ```env GROQ_API_KEY=your_groq_api_key_here ``` You can create a Groq API key from: ๐Ÿ‘‰ [https://console.groq.com/](https://console.groq.com/) ### 5. Run the App ```bash streamlit run app.py ``` Open the local URL shown in your terminal. --- ## ๐Ÿ”‘ How to Get a Groq API Key 1. Go to [Groq Console](https://console.groq.com/) 2. Sign in or create an account 3. Open **API Keys** 4. Create a new API key 5. Copy the key 6. Paste it into the app sidebar or save it in `.env` For Hugging Face Spaces, add it as a secret: ```text GROQ_API_KEY = your_key_here ``` --- ## ๐Ÿšข Hugging Face Deployment 1. Create a new Hugging Face Space. 2. Choose **Streamlit** as the SDK. 3. Upload: - `app.py` - `README.md` - `requirements.txt` - `runtime.txt` - `.gitattributes` - `assets/` 4. Add `GROQ_API_KEY` in **Settings -> Secrets**. 5. Optional: add `APP_PASSWORD` in **Settings -> Secrets** to protect the app. 6. 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](DEPLOYMENT.md) for the full deployment guide. --- ## ๐Ÿ’ก Example Questions Try these after uploading and processing a document: ```text Summarize this document in 6 crisp bullet points. ``` ```text What are the key risks, warnings, or limitations? ``` ```text Extract all names, dates, numbers, and important terms. ``` ```text Create an action-item checklist from this document. ``` ```text Explain this document like I am new to the topic. ``` ```text 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
### Built by **Dinesh Barri** Data Analyst | AI Automation Engineer | Founder @ Plemdo AI

--- ## โญ 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.