Spaces:
Sleeping
Sleeping
| # Quick Start Guide - Hugging Face Spaces Deployment | |
| ## π 5-Minute Deployment | |
| ### Step 1: Get Token (2 minutes) | |
| ```bash | |
| # 1. Visit: https://huggingface.co/settings/tokens | |
| # 2. Click "New token" | |
| # 3. Name: "RAG System", Permissions: "read" | |
| # 4. Copy token (starts with hf_) | |
| ``` | |
| ### Step 2: Test Locally (Optional but Recommended) | |
| ```bash | |
| cd /Users/v.hirenko/Desktop/DevHubVault/my-ai-projects/rag-python-rag | |
| # Set token | |
| export HF_TOKEN=hf_your_token_here | |
| # Install dependencies (if not done) | |
| pip install -r requirements.txt | |
| # Run tests | |
| python test_hf_integration.py | |
| # If all pass, test app | |
| python app.py | |
| # Open http://localhost:7860 | |
| ``` | |
| ### Step 3: Create Space (1 minute) | |
| ```bash | |
| # 1. Go to: https://huggingface.co/new-space | |
| # 2. Fill in: | |
| # - Name: rag-python-rag | |
| # - SDK: Gradio | |
| # - Hardware: CPU basic (free) | |
| # 3. Click "Create Space" | |
| ``` | |
| ### Step 4: Add Secret (1 minute) | |
| ```bash | |
| # 1. Go to your Space Settings | |
| # 2. Find "Repository secrets" | |
| # 3. Add: | |
| # - Name: HF_TOKEN | |
| # - Value: Your token from Step 1 | |
| # 4. Click "Add" | |
| ``` | |
| ### Step 5: Deploy (1 minute) | |
| ```bash | |
| cd /Users/v.hirenko/Desktop/DevHubVault/my-ai-projects/rag-python-rag | |
| # Add HF Space as remote (replace YOUR_USERNAME) | |
| git remote add hf https://huggingface.co/spaces/YOUR_USERNAME/rag-python-rag | |
| # Push code | |
| git push hf main | |
| # Username: YOUR_USERNAME | |
| # Password: Your HF token | |
| ``` | |
| ### Step 6: Verify | |
| ```bash | |
| # 1. Go to your Space URL | |
| # 2. Wait for "Running" status | |
| # 3. Try example questions | |
| # 4. Done! π | |
| ``` | |
| ## π Quick Commands | |
| ```bash | |
| # Test locally | |
| export HF_TOKEN=hf_xxx && python test_hf_integration.py | |
| # Run app locally | |
| python app.py | |
| # Deploy to HF Spaces | |
| git push hf main | |
| # Update after changes | |
| git add . && git commit -m "Update" && git push hf main | |
| ``` | |
| ## π Quick Links | |
| - **Get Token**: https://huggingface.co/settings/tokens | |
| - **Create Space**: https://huggingface.co/new-space | |
| - **Your Repo**: https://github.com/monsara/rag-python-rag | |
| ## π Full Documentation | |
| - `DEPLOYMENT_GUIDE.md` - Complete deployment walkthrough | |
| - `ENV_SETUP.md` - Environment variables | |
| - `MIGRATION_SUMMARY.md` - What changed | |
| - `README_HF.md` - HF Spaces README | |
| ## β οΈ Common Issues | |
| **"HF_TOKEN not found"** | |
| β Add token to Space Settings β Repository secrets | |
| **"Model not found"** | |
| β Check model name in `config.py` is correct | |
| **"Rate limit exceeded"** | |
| β Free tier: ~1000 requests/hour. Wait or upgrade to Pro. | |
| **Build failed** | |
| β Check Space logs for errors | |
| ## π‘ Tips | |
| - Test locally before deploying | |
| - Keep HF_TOKEN secure | |
| - Monitor Space logs | |
| - Free tier is enough for testing | |
| - Upgrade to Pro ($9/mo) for production | |
| --- | |
| **Need help?** See `DEPLOYMENT_GUIDE.md` for detailed instructions. | |