Spaces:
Build error
Build error
| title: Document Assistant | |
| emoji: ๐ | |
| colorFrom: blue | |
| colorTo: yellow | |
| sdk: gradio | |
| sdk_version: 5.4.0 | |
| python_version: "3.11" | |
| app_file: app.py | |
| pinned: false | |
| # Document Assistant (SPJIMR Branded) | |
| A simple, document-aware chatbot built with Gradio, FAISS, and Hugging Face Inference API. | |
| ## Features | |
| - **File Support**: PDF, DOCX, TXT. | |
| - **RAG Engine**: Uses `Sentence-Transformers` for embeddings and `FAISS` for fast retrieval. | |
| - **UI**: Customized Gradio Blocks with SPJIMR branding (Deep Blue & Gold). | |
| - **LLM**: Powered by Mistral-7B via Hugging Face Inference API. | |
| ## Local Setup | |
| 1. Clone this repository. | |
| 2. Install dependencies: | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| 3. Set your Hugging Face Token (required for LLM access): | |
| - Windows (PowerShell): `$env:HF_TOKEN="your_token_here"` | |
| - Linux/Mac: `export HF_TOKEN="your_token_here"` | |
| 4. Run the app: | |
| ```bash | |
| python app.py | |
| ``` | |
| ## Deployment to Hugging Face Spaces | |
| 1. Create a new Space on [Hugging Face](https://huggingface.co/new-space). | |
| 2. Select **Gradio** as the SDK. | |
| 3. Upload `app.py` and `requirements.txt`. | |
| 4. Go to **Settings** > **Variables and Secrets**. | |
| 5. Add a new **Secret**: | |
| - Key: `HF_TOKEN` | |
| - Value: Your Hugging Face User Access Token (from [hf.co/settings/tokens](https://huggingface.co/settings/tokens)). | |
| 6. The Space will build and deploy automatically! | |
| ## Built with | |
| - [Gradio](https://gradio.app/) | |
| - [FAISS](https://github.com/facebookresearch/faiss) | |
| - [Sentence-Transformers](https://www.sbert.net/) | |
| - [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index) | |