--- title: LLM Data Analyzer emoji: 📊 colorFrom: blue colorTo: indigo sdk: docker sdk_version: latest app_file: app.py pinned: false --- # 📊 LLM Data Analyzer An AI-powered tool for analyzing data and having conversations with an intelligent assistant powered by Llama 2. ## Features - **📤 Upload & Analyze**: Upload CSV or Excel files and get instant analysis - **💬 Chat**: Have conversations with Llama 2 AI assistant - **📊 Data Statistics**: View comprehensive data summaries and insights - **🚀 Fast**: Runs on free Hugging Face CPU tier ## How to Use 1. **Upload Data** - Start by uploading a CSV or Excel file 2. **Preview** - Review your data and statistics 3. **Ask Questions** - Get AI-powered analysis and insights 4. **Chat** - Have follow-up conversations with the AI ## Technology Stack - **Model**: Llama 2 7B (quantized to 4-bit) - **Framework**: Streamlit - **Inference Engine**: Llama.cpp - **Hosting**: Hugging Face Spaces - **Language**: Python 3.10+ ## Performance | Metric | Value | |--------|-------| | Speed | ~5-10 tokens/second (free CPU) | | Model Size | 4GB (quantized) | | Context Window | 2048 tokens | | First Load | ~30 seconds (model download) | | Subsequent Responses | ~5-15 seconds | | Hardware | Free Hugging Face CPU | ## Local Development (Faster) For faster local development with GPU acceleration on Apple Silicon Mac: ```bash # Clone the repository git clone https://github.com/Arif-Badhon/LLM-Data-Analyzer cd LLM-Data-Analyzer # Switch to huggingface-deployment branch git checkout huggingface-deployment # Install dependencies pip install -r requirements.txt # Run with MLX (Apple Silicon GPU - ~70 tokens/second) streamlit run app.py ``` ## Deployment Options ### Option 1: Hugging Face Space (Free) - CPU-based inference - Speed: 5-10 tokens/second - Cost: Free ### Option 2: Local with MLX (Fastest) - GPU-accelerated on Apple Silicon - Speed: 70+ tokens/second - Cost: Free (uses your Mac) ### Option 3: Hugging Face PRO (Fast) - GPU-accelerated inference - Speed: 50+ tokens/second - Cost: $9/month ## Getting Started ### Quick Start (3 minutes) ```bash # 1. Install Python 3.10+ # 2. Clone repo git clone https://github.com/Arif-Badhon/LLM-Data-Analyzer cd LLM-Data-Analyzer # 3. Install dependencies pip install -r requirements.txt # 4. Run Streamlit app streamlit run app.py ``` ### With Docker (Local Development) ```bash # Make sure Docker Desktop is running docker-compose up --build # Access at http://localhost:8501 ``` ## Troubleshooting ### "Model download failed" - Check internet connection - HF Spaces need internet to download models from Hugging Face Hub - Wait and refresh the page ### "App takes too long to load" - Normal on first request (10-30 seconds) - Model is being downloaded and cached - Subsequent requests are much faster ### "Out of memory" - Free tier CPU is limited - Unlikely with quantized 4GB model - If it happens, upgrade to HF PRO ### "Slow responses" - Free tier CPU is slower than GPU - Expected: 5-10 tokens/second - For faster responses: use local MLX (70 t/s) or upgrade HF tier ## Technologies Used - **Python** - Core language - **Streamlit** - Web UI framework - **Llama 2** - Large language model - **Llama.cpp** - CPU inference - **MLX** - Apple Silicon GPU inference - **Pandas** - Data processing - **Docker** - Containerization - **Hugging Face Hub** - Model hosting ## License MIT License ## Author **Arif Badhon** ## Support If you encounter any issues: 1. Check the Troubleshooting section above 2. Review Hugging Face Spaces Docs 3. Open an issue on GitHub --- **Happy analyzing! 🚀**