Spaces:
Sleeping
Sleeping
File size: 2,717 Bytes
03d02f2 | 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 | # 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.
|