Spaces:
Paused
Paused
File size: 7,675 Bytes
bc10808 | 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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | # π START HERE - Graph RAG Chatbot
Welcome! This is your complete Graph-based RAG chatbot with knowledge graph visualization.
## What You Have π¦
A production-ready Flask application that:
- π€ Accepts PDF, CSV, TXT documents
- π Builds and visualizes knowledge graphs
- π¬ Answers questions using RAG (Retrieval-Augmented Generation)
- π¨ Beautiful responsive UI (mobile-friendly)
- π³ Docker-ready for deployment
- π€ Hugging Face Spaces compatible
---
## Get Started in 3 Steps β‘
### Step 1: Get API Key (2 minutes)
```bash
# Visit: https://console.groq.com
# Sign up β Create API key β Copy it
```
### Step 2: Start the App (Choose One)
#### Option A: Docker Compose (Recommended)
```bash
cp .env.example .env
# Edit .env and paste your API key
docker-compose up -d
# Open: http://localhost:7860
```
#### Option B: Python (Local)
```bash
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
export GROQ_API_KEY="your_key" # Windows: set GROQ_API_KEY=your_key
python app.py
# Open: http://localhost:7860
```
#### Option C: Hugging Face Spaces (Cloud)
See **space_config.md** for detailed steps
### Step 3: Use the App
1. Upload a document (PDF, CSV, or TXT)
2. Wait for "ready" status
3. Ask a question in the chat
4. View the knowledge graph!
---
## File Guide π
| File | Purpose | Read When |
|---|---|---|
| **QUICKSTART.md** | 5-minute quick start | You want to run it NOW |
| **README.md** | Complete documentation | You want detailed info |
| **TESTING.md** | Testing guide + test cases | You want to test features |
| **space_config.md** | Hugging Face deployment | You want to deploy to cloud |
| **DEPLOYMENT_CHECKLIST.md** | Production checklist | You're going live |
| **PROJECT_STRUCTURE.md** | Architecture & file details | You want to customize |
---
## Common Questions π€
### Q: Where do I get the API key?
**A**: Visit https://console.groq.com, sign up, and create an API key. It's free!
### Q: Do I need Docker?
**A**: No! Run locally with Python or use HF Spaces (no setup needed).
### Q: Can I change the UI?
**A**: Yes! Edit `templates/index.html`. It's plain HTML/CSS/JS.
### Q: How do I deploy to production?
**A**: See DEPLOYMENT_CHECKLIST.md or space_config.md for HF Spaces.
### Q: What file types are supported?
**A**: PDF, CSV, TXT. More can be added by editing `app.py`.
### Q: Can multiple users use it?
**A**: Yes! Each browser session is independent. Add authentication if needed.
### Q: How big can files be?
**A**: Up to 50MB. Change `MAX_CONTENT_LENGTH` in `app.py` if needed.
### Q: Is my data private?
**A**: Files are stored on your server only. Never sent to Groq (except queries).
### Q: What's a knowledge graph?
**A**: It visualizes relationships between documents and concepts as an interactive network diagram.
### Q: How does RAG work?
**A**: Your question is matched to relevant document chunks, then an AI generates an answer based on those chunks.
---
## Project Files π
```
your-project/
βββ app.py # Main application
βββ templates/index.html # Frontend UI
βββ requirements.txt # Dependencies
βββ Dockerfile # Docker image
βββ docker-compose.yml # Docker setup
βββ .env.example # Config template
βββ README.md # Full documentation
βββ QUICKSTART.md # 5-min guide
βββ TESTING.md # Testing guide
βββ space_config.md # HF Spaces guide
βββ DEPLOYMENT_CHECKLIST.md # Production guide
βββ PROJECT_STRUCTURE.md # Architecture
βββ data/ # Storage (created automatically)
```
---
## Troubleshooting π§
### "GROQ_API_KEY not found"
```bash
# Windows
echo GROQ_API_KEY=your_key >> .env
# Mac/Linux
echo "GROQ_API_KEY=your_key" >> .env
```
### "Port 7860 is already in use"
```bash
# Option 1: Use different port
PORT=8000 python app.py
# Option 2: Find and stop the process using 7860
lsof -i :7860 # Mac/Linux
netstat -ano | findstr :7860 # Windows
```
### "Docker not found"
Install Docker from https://docker.com
### "Graph doesn't load"
- Ensure document status is "ready"
- Wait 3-5 seconds after upload
- Check browser console (F12)
### "Chat not responding"
- Verify GROQ_API_KEY is set
- Check document is "ready" status
- Ensure internet connectivity
---
## Next Steps π―
1. **Run locally**: Execute one of the 3 options above
2. **Test features**: Upload a sample CSV or PDF
3. **Explore code**: Look at `app.py` to understand the flow
4. **Customize**: Edit `templates/index.html` for styling
5. **Deploy**: Push to HF Spaces or your server (see guides)
---
## Feature Highlights β¨
| Feature | Status | Notes |
|---|---|---|
| π€ Upload Documents | β
| PDF, CSV, TXT |
| π Knowledge Graphs | β
| Auto-generated, visualized |
| π¬ RAG Chat | β
| Semantic search + LLM |
| π¨ Beautiful UI | β
| Modern, responsive |
| π Fast | β
| Async processing |
| π± Mobile | β
| Fully responsive |
| π³ Docker Ready | β
| One command to run |
| π€ HF Spaces Ready | β
| Easy cloud deploy |
---
## Technology Stack π οΈ
- **Backend**: Flask (Python)
- **LLM**: Groq Mixtral 8x7b
- **Embeddings**: SentenceTransformers
- **Graphs**: NetworkX + Matplotlib
- **Frontend**: HTML + CSS + JavaScript
- **Deployment**: Docker + Docker Compose
---
## Performance π
| Operation | Time |
|---|---|
| App startup (cold) | 30-60s (model download) |
| App startup (warm) | 2-3s |
| Upload small file | 5-10s |
| Upload large file | 30-60s |
| Query response | 2-5s |
| Graph visualization | <1s |
---
## Architecture ποΈ
```
User Browser
β
HTML/CSS/JS Frontend
β
Flask Backend (Python)
ββ Document Processing
ββ Knowledge Graph Building
ββ Embedding Generation
ββ RAG Query Processing
β
Groq API (LLM)
```
---
## Support & Help π¬
1. **Quick questions**: Check this file (START_HERE.md)
2. **Detailed help**: See README.md
3. **Testing**: See TESTING.md
4. **Deployment**: See DEPLOYMENT_CHECKLIST.md or space_config.md
5. **Architecture**: See PROJECT_STRUCTURE.md
6. **Issues**: Check code comments in app.py
---
## Your Next Action π
**Pick your favorite option above and run it now!**
```bash
# Fastest way:
docker-compose up -d
# Or if you have Python 3.8+:
python app.py
# Or deploy to cloud:
# See space_config.md
```
---
## Success Indicators β
Once running, you should see:
- β
Blue gradient homepage
- β
Upload zone with drag-and-drop
- β
Chat section on the right
- β
"Knowledge Graph" tab visible
- β
No error messages
---
**Ready? Let's go! π**
---
## Key Files Explained in 30 Seconds
| File | What It Does |
|---|---|
| `app.py` | Flask app + AI logic |
| `index.html` | The web interface users see |
| `Dockerfile` | Containerizes the app for deployment |
| `requirements.txt` | Lists all Python packages needed |
| `docker-compose.yml` | Easy way to run with Docker |
| `.env.example` | Template for configuration |
---
## One More Thing... π
This project is **production-ready**. You can:
- Deploy to Hugging Face Spaces (free, cloud)
- Deploy to AWS, Azure, GCP (paid cloud)
- Run on your own server
- Run locally for testing
- Customize to your needs
**Everything you need is included!** π
---
**Questions?** Read the relevant guide file above.
**Ready to start?** Run Docker Compose or Python.
**Want to deploy?** Check DEPLOYMENT_CHECKLIST.md.
---
*Created: June 27, 2024*
*Version: 1.0.0*
*Status: Production Ready β
*
|