Intel_classification / PRE_DEPLOYMENT_CHECKLIST.md
danielle2035's picture
Add
fbd6723
|
Raw
History Blame Contribute Delete
4.33 kB

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

# 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:

# 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
  2. Quick Start: QUICK_START.md
  3. Changes Made: REORGANIZATION.md
  4. GitHub Issues: Report bugs
  5. HF Discussions: Ask community

Estimated Total Time: 15-30 minutes (first-time setup)

Good luck! πŸš€