Spaces:
Sleeping
Quick Start Guide - Intel Image Classifier
Get up and running in minutes!
Prereq: Install Models
Before deploying, you need your trained models. Place them in:
backend/api/models/
βββ pytorch_model.pth # PyTorch model weights
βββ model_best.keras # TensorFlow/Keras model
Note: If you don't have these files yet, see /ml/ directory for training scripts.
Option A: Deploy to Hugging Face (Recommended β)
Step 1: Create Space on Hugging Face
- Go to huggingface.co/spaces
- Click "Create new Space"
- Choose:
- Name:
Intel_classification - License: MIT
- Space SDK: Docker
- Visibility: Public
- Name:
Step 2: Clone and Update Repository
# Clone this repo
git clone https://github.com/danielle2035/Intel_classification.git
cd Intel_classification
# Add your trained models to backend/api/models/
cp /path/to/pytorch_model.pth backend/api/models/
cp /path/to/model_best.keras backend/api/models/
# Add Hugging Face remote
git remote add hf https://huggingface.co/spaces/YOUR_HF_USERNAME/Intel_classification
Step 3: Deploy!
git push hf main
Done! Watch your Space build and deploy automatically. Access it at:
https://huggingface.co/spaces/YOUR_HF_USERNAME/Intel_classification
Option B: Run Locally with Docker
Easiest Way
# Build the image
docker build -t intel-classifier .
# Run it
docker run -p 7860:7860 intel-classifier
Then open: http://localhost:7860
With Docker Compose (Development)
docker-compose up --build
Services:
- Frontend: http://localhost:3000
- Backend: http://localhost:8000
- Docs: http://localhost:8000/swagger
Option C: Run Locally Without Docker
Backend Setup
cd backend/api
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r ../requirements.txt
# Run migrations
python manage.py migrate
# Start server
python manage.py runserver 8000
Keep terminal open. Backend runs on http://localhost:8000
Frontend Setup (New Terminal)
cd frontend
# Install dependencies
npm install
# Start development server
npm start
Frontend runs on http://localhost:3000
Testing Your Deployment
1. Check Health
curl http://localhost:7860/health/
# Expected: {"status": "healthy", "service": "Intel Image Classifier API", "version": "1.0.0"}
2. Classify an Image
curl -X POST \
-F "image=@test_image.jpg" \
-F "model=pytorch" \
http://localhost:7860/api/classify/
3. Visit Web Interface
Open in browser: http://localhost:7860
4. Check API Docs
- Swagger: http://localhost:7860/swagger/
- ReDoc: http://localhost:7860/redoc/
- Admin Panel: http://localhost:7860/admin/ (user: admin, pass: admin)
Troubleshooting
"Port 7860 already in use"
# Find what's using it
lsof -i :7860
# Kill the process
kill -9 <PID>
"Models not found"
Ensure these files exist:
backend/api/models/pytorch_model.pthbackend/api/models/model_best.keras
If missing, only one model will be available.
"CORS Error"
This usually means backend and frontend are on different domains. Verify:
- Docker mode: Both on same domain β
- Local dev: Frontend 3000, Backend 8000 - they communicate via proxy β
- HF Spaces: Auto-configured β
"Models take too long to load"
First startup loads models into memory. This can take 1-2 minutes for large models. Subsequent requests are fast!
Common Tasks
Change Confidence Threshold
Edit backend/api/notifications/api_views.py:
CONFIDENCE_THRESHOLD = 0.6 # Change this value
Add Custom Classes
Update CLASSES list in backend/api/notifications/api_views.py:
CLASSES = ["buildings", "forest", "glacier", "mountain", "sea", "street", "YOUR_CLASS"]
Then retrain your models.
Use a Different Model
Add to backend/api/models/:
pytorch_model.pthmodel_best.keras
The API automatically detects available models.
File Structure Reference
intel-classifier/
βββ Dockerfile # Docker configuration
βββ README.md # Main documentation
βββ DEPLOYMENT.md # Detailed deployment guide
βββ REORGANIZATION.md # What changed
βββ QUICK_START.md # This file!
β
βββ backend/
β βββ api/notifications/ # Image classification API
β β βββ api_views.py
β βββ models/ # Your trained models
β β βββ pytorch_model.pth
β β βββ model_best.keras
β βββ requirements.txt
β
βββ frontend/ # React web interface
β βββ src/App.js
β βββ package.json
β
βββ ml/ # Training scripts (for reference)
βββ models/
Next Steps
- β Add your trained models
- β Test locally (Docker or native)
- β Push to Hugging Face Spaces
- β Share with friends!
- π Monitor predictions at
/admin/ - π Retrain to improve accuracy
- π Add more features (authentication, history, etc.)
Support
Need help?
- Documentation: See DEPLOYMENT.md
- Issues: GitHub Issues
- Discussions: HF Space Discussions
Ready? Let's go! π
Choose your deployment method above and follow the steps!