Spaces:
Configuration error
Configuration error
| # π PDF Chatbot β Runs in Your Browser | |
| A **zero-server, zero-API-key** chatbot that lets you ask questions about your PDFs using lightweight AI models running entirely in your browser. | |
| π **Live Demo**: https://huggingface.co/spaces/ghostofpk20/pdf-chatbot-browser | |
| --- | |
| ## π Try It Now (No Installation!) | |
| Just open the link above and start chatting with your PDFs. That's it. | |
| > **First use only**: The AI embedding model (~22MB) downloads from Hugging Face. After that, it works **completely offline**. | |
| --- | |
| ## π§ How It Works | |
| | Step | What Happens | | |
| |------|-------------| | |
| | 1. Upload PDF | PDF.js extracts text entirely in your browser | | |
| | 2. Chunk & Index | Text is split into chunks; each chunk gets an AI embedding vector | | |
| | 3. Ask Question | Your question is embedded; top-K matching chunks are retrieved | | |
| | 4. Get Answer | Best sentences from matching chunks are extracted and returned | | |
| All processing happens **locally** β your PDFs never leave your device. | |
| --- | |
| ## π― Key Features | |
| - β **Fully offline** after first download β no servers, no API keys | |
| - β **Drag & drop** PDF upload | |
| - β **Multiple PDFs** β chat with any uploaded document | |
| - β **WebGPU acceleration** β 5-10x faster on Chrome/Edge with GPU | |
| - β **WASM fallback** β works on any modern browser | |
| - β **Keyword fallback** β still searches if AI model fails | |
| - β **Sources shown** β every answer includes the document excerpts used | |
| - β **No scanned PDFs** β text-based PDFs only (browser limitation) | |
| --- | |
| ## π¦ Chrome Extension (Bonus) | |
| Download `chrome-extension.zip` from the files tab and load it as an unpacked extension in `chrome://extensions/`. | |
| --- | |
| ## π οΈ Models Used | |
| | Model | Size | Purpose | | |
| |-------|------|---------| | |
| | `Xenova/all-MiniLM-L6-v2` | ~22MB (q8) | Text embeddings for document retrieval | | |
| - **ONNX quantized** to 8-bit for minimal memory | |
| - **Runs via Transformers.js** + ONNX Runtime Web | |
| - **Answers are extractive** β no LLM hallucinations, just facts from your document | |
| --- | |
| ## π Privacy | |
| - **Zero network calls** after model download | |
| - **Your PDFs never leave your browser** | |
| - **No analytics, no tracking, no API keys** | |
| - Everything stays in browser memory only | |
| --- | |
| ## π Browser Support | |
| | Browser | Status | | |
| |---------|--------| | |
| | Chrome 113+ | β Full (WebGPU) | | |
| | Edge 113+ | β Full (WebGPU) | | |
| | Firefox | β οΈ WASM fallback | | |
| | Safari 17.4+ | β οΈ WebGPU in preview | | |
| --- | |
| ## π Credits | |
| - [Transformers.js](https://huggingface.co/docs/transformers.js) β ML in the browser | |
| - [PDF.js](https://mozilla.github.io/pdf.js/) β PDF text extraction | |
| - [ONNX Runtime Web](https://onnxruntime.ai/) β Model inference | |