Spaces:
Paused
Paused
| # π 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 β * | |