Spaces:
Sleeping
Sleeping
File size: 4,334 Bytes
fbd6723 | 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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | # Pre-Deployment Checklist β
Complete this checklist before deploying to Hugging Face Spaces.
## 1. Model Files
- [ ] `pytorch_model.pth` is in `backend/api/models/`
- [ ] `model_best.keras` is in `backend/api/models/`
- [ ] Both models are in HuggingFace LFS format (`.gitattributes`)
- [ ] Models are not corrupted (test locally first)
## 2. Local Testing
- [ ] Cloned repository successfully
- [ ] Added trained models
- [ ] Built Docker image: `docker build -t intel .`
- [ ] Container starts without errors
- [ ] Can access http://localhost:7860
- [ ] Classification endpoint works: POST to `/api/classify/`
- [ ] Frontend loads properly
- [ ] API documentation visible at `/swagger/`
## 3. Configuration
- [ ] Updated `.env` if using custom settings
- [ ] Verified `ALLOWED_HOSTS` includes HF domains
- [ ] Checked `CORS_ALLOWED_ORIGINS` is correct
- [ ] Confirmed `DEBUG=False` for production
- [ ] Reviewed `DJANGO_SECRET_KEY` (auto-set is fine)
## 4. Code Quality
- [ ] No hardcoded API keys or passwords
- [ ] Removed development-only code
- [ ] All imports are available in `requirements.txt`
- [ ] No local file paths hardcoded
- [ ] Verified .gitignore doesn't exclude needed files
## 5. Git & Repository
- [ ] All changes committed: `git status` is clean
- [ ] `.env` is in `.gitignore` (no secrets in repo)
- [ ] Model files tracked with Git LFS if large
- [ ] Remote configured: `git remote add hf <HF_SPACE_URL>`
- [ ] Tested: `git push --dry-run hf main`
## 6. Documentation
- [ ] README.md updated with your username
- [ ] Updated citation with your info
- [ ] Added your model training notes if relevant
- [ ] Confirmed DEPLOYMENT.md is accurate
- [ ] Link to your HF Space is correct
## 7. Hugging Face Setup
- [ ] Created Hugging Face Space
- [ ] Set space as "Docker" SDK
- [ ] Set visibility (Public/Private)
- [ ] Added appropriate description and license
- [ ] Configured any secrets needed (if API keys used)
## 8. Final Tests (Optional)
- [ ] Run `docker build .` one more time
- [ ] Test with different image formats (jpg, png, webp)
- [ ] Test with both model options (pytorch, tensorflow)
- [ ] Verify error handling (invalid image, bad requests)
- [ ] Check performance with larger images
## 9. Deployment
- [ ] All above checks passed β
- [ ] Ready message: `git push hf main`
- [ ] Monitoring HF Space for build progress
- [ ] Verified Space URL is accessible
- [ ] Tested deployed Space (give it 5 minutes to start)
## 10. Post-Deployment
- [ ] Space is running without errors
- [ ] All endpoints respond correctly
- [ ] Frontend loads on live URL
- [ ] API returns correct predictions
- [ ] No CORS or security errors
- [ ] Shared link with team/public
---
## Deployment Command
```bash
# Final push to Hugging Face
git push hf main
# View logs (from HF Space interface)
# Monitor at: https://huggingface.co/spaces/USERNAME/Intel_classification/logs
```
---
## Rollback Plan
If something goes wrong:
```bash
# Revert to previous working state
git log --oneline | head -5
git reset --hard <COMMIT_HASH>
git push hf main --force # Force push (use with caution)
# Or fix issues and push again
git add .
git commit -m "Fix: description of fix"
git push hf main
```
---
## Common Issues & Fixes
| Issue | Solution |
|-------|----------|
| Build timeout | Reduce image size or optimize dependencies |
| Out of memory | Prune unused Docker images/volumes |
| Models not loading | Verify file names match exactly |
| CORS errors | Check Django CSRF_TRUSTED_ORIGINS |
| Port conflicts | Ensure 7860 is available locally |
| Frontend not showing | Check React build in `frontend/build/` |
---
## Success Indicators β¨
Your deployment is successful when:
1. β
HF Space shows "Running" status
2. β
Website loads at your HF Space URL
3. β
Cannot refund with different images
4. β
Both models are selectable
5. β
API documentation (/swagger) is accessible
6. β
Admin panel works (/admin/)
7. β
No errors in HF Space logs
---
## Need Help?
1. **Documentation**: [DEPLOYMENT.md](DEPLOYMENT.md)
2. **Quick Start**: [QUICK_START.md](QUICK_START.md)
3. **Changes Made**: [REORGANIZATION.md](REORGANIZATION.md)
4. **GitHub Issues**: Report bugs
5. **HF Discussions**: Ask community
---
**Estimated Total Time**: 15-30 minutes (first-time setup)
**Good luck! π**
|