File size: 1,398 Bytes
eb4f1c5
 
 
 
 
 
 
 
 
 
 
668f677
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eb4f1c5
 
668f677
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eb4f1c5
668f677
 
eb4f1c5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
title: Self-Service KB Assistant
emoji: 📚
colorFrom: indigo
colorTo: blue
sdk: docker
app_port: 7860
pinned: false
short_description: RAG chat over your docs with source attribution
---

# Self-Service KB Assistant

AI-powered knowledge base chat assistant. Upload documents, ask questions in plain language, get grounded answers with source attribution.

## Stack
- **Backend:** FastAPI + FLAN-T5 (seq2seq QA) + FAISS (vector search) + sentence-transformers
- **Frontend:** Single HTML file — no framework, no build step
- **File support:** .txt · .md · .pdf · .docx

## Run locally
```bash
pip install -r requirements.txt
python app.py
# Open http://localhost:7860
```

## Deploy on HuggingFace Spaces
1. Create a new Space, SDK: **Docker**
2. Upload all files (app.py, requirements.txt, static/, config.yaml, kb/, Dockerfile)
3. Include this `Dockerfile`:

```dockerfile
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 7860
CMD ["python", "app.py"]
```

## Project structure
```
app.py              FastAPI backend + RAG pipeline
static/index.html   Complete UI (HTML/CSS/JS)
config.yaml         App configuration
requirements.txt    Python dependencies
Dockerfile          Container build for HF Spaces
kb/                 Your knowledge base documents
.cache/faiss/       Auto-generated vector index
```