Spaces:
Sleeping
Sleeping
viktor-hirenko commited on
Commit Β·
03d02f2
1
Parent(s): 5fd4bb2
docs: add quick start guide for 5-minute deployment
Browse files- QUICK_START.md +125 -0
QUICK_START.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Quick Start Guide - Hugging Face Spaces Deployment
|
| 2 |
+
|
| 3 |
+
## π 5-Minute Deployment
|
| 4 |
+
|
| 5 |
+
### Step 1: Get Token (2 minutes)
|
| 6 |
+
```bash
|
| 7 |
+
# 1. Visit: https://huggingface.co/settings/tokens
|
| 8 |
+
# 2. Click "New token"
|
| 9 |
+
# 3. Name: "RAG System", Permissions: "read"
|
| 10 |
+
# 4. Copy token (starts with hf_)
|
| 11 |
+
```
|
| 12 |
+
|
| 13 |
+
### Step 2: Test Locally (Optional but Recommended)
|
| 14 |
+
```bash
|
| 15 |
+
cd /Users/v.hirenko/Desktop/DevHubVault/my-ai-projects/rag-python-rag
|
| 16 |
+
|
| 17 |
+
# Set token
|
| 18 |
+
export HF_TOKEN=hf_your_token_here
|
| 19 |
+
|
| 20 |
+
# Install dependencies (if not done)
|
| 21 |
+
pip install -r requirements.txt
|
| 22 |
+
|
| 23 |
+
# Run tests
|
| 24 |
+
python test_hf_integration.py
|
| 25 |
+
|
| 26 |
+
# If all pass, test app
|
| 27 |
+
python app.py
|
| 28 |
+
# Open http://localhost:7860
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
### Step 3: Create Space (1 minute)
|
| 32 |
+
```bash
|
| 33 |
+
# 1. Go to: https://huggingface.co/new-space
|
| 34 |
+
# 2. Fill in:
|
| 35 |
+
# - Name: rag-python-rag
|
| 36 |
+
# - SDK: Gradio
|
| 37 |
+
# - Hardware: CPU basic (free)
|
| 38 |
+
# 3. Click "Create Space"
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
### Step 4: Add Secret (1 minute)
|
| 42 |
+
```bash
|
| 43 |
+
# 1. Go to your Space Settings
|
| 44 |
+
# 2. Find "Repository secrets"
|
| 45 |
+
# 3. Add:
|
| 46 |
+
# - Name: HF_TOKEN
|
| 47 |
+
# - Value: Your token from Step 1
|
| 48 |
+
# 4. Click "Add"
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
### Step 5: Deploy (1 minute)
|
| 52 |
+
```bash
|
| 53 |
+
cd /Users/v.hirenko/Desktop/DevHubVault/my-ai-projects/rag-python-rag
|
| 54 |
+
|
| 55 |
+
# Add HF Space as remote (replace YOUR_USERNAME)
|
| 56 |
+
git remote add hf https://huggingface.co/spaces/YOUR_USERNAME/rag-python-rag
|
| 57 |
+
|
| 58 |
+
# Push code
|
| 59 |
+
git push hf main
|
| 60 |
+
# Username: YOUR_USERNAME
|
| 61 |
+
# Password: Your HF token
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
### Step 6: Verify
|
| 65 |
+
```bash
|
| 66 |
+
# 1. Go to your Space URL
|
| 67 |
+
# 2. Wait for "Running" status
|
| 68 |
+
# 3. Try example questions
|
| 69 |
+
# 4. Done! π
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
## π Quick Commands
|
| 73 |
+
|
| 74 |
+
```bash
|
| 75 |
+
# Test locally
|
| 76 |
+
export HF_TOKEN=hf_xxx && python test_hf_integration.py
|
| 77 |
+
|
| 78 |
+
# Run app locally
|
| 79 |
+
python app.py
|
| 80 |
+
|
| 81 |
+
# Deploy to HF Spaces
|
| 82 |
+
git push hf main
|
| 83 |
+
|
| 84 |
+
# Update after changes
|
| 85 |
+
git add . && git commit -m "Update" && git push hf main
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
## π Quick Links
|
| 89 |
+
|
| 90 |
+
- **Get Token**: https://huggingface.co/settings/tokens
|
| 91 |
+
- **Create Space**: https://huggingface.co/new-space
|
| 92 |
+
- **Your Repo**: https://github.com/monsara/rag-python-rag
|
| 93 |
+
|
| 94 |
+
## π Full Documentation
|
| 95 |
+
|
| 96 |
+
- `DEPLOYMENT_GUIDE.md` - Complete deployment walkthrough
|
| 97 |
+
- `ENV_SETUP.md` - Environment variables
|
| 98 |
+
- `MIGRATION_SUMMARY.md` - What changed
|
| 99 |
+
- `README_HF.md` - HF Spaces README
|
| 100 |
+
|
| 101 |
+
## β οΈ Common Issues
|
| 102 |
+
|
| 103 |
+
**"HF_TOKEN not found"**
|
| 104 |
+
β Add token to Space Settings β Repository secrets
|
| 105 |
+
|
| 106 |
+
**"Model not found"**
|
| 107 |
+
β Check model name in `config.py` is correct
|
| 108 |
+
|
| 109 |
+
**"Rate limit exceeded"**
|
| 110 |
+
β Free tier: ~1000 requests/hour. Wait or upgrade to Pro.
|
| 111 |
+
|
| 112 |
+
**Build failed**
|
| 113 |
+
β Check Space logs for errors
|
| 114 |
+
|
| 115 |
+
## π‘ Tips
|
| 116 |
+
|
| 117 |
+
- Test locally before deploying
|
| 118 |
+
- Keep HF_TOKEN secure
|
| 119 |
+
- Monitor Space logs
|
| 120 |
+
- Free tier is enough for testing
|
| 121 |
+
- Upgrade to Pro ($9/mo) for production
|
| 122 |
+
|
| 123 |
+
---
|
| 124 |
+
|
| 125 |
+
**Need help?** See `DEPLOYMENT_GUIDE.md` for detailed instructions.
|