ioget/aims-cv-app
0
Intel Image Classifier — Flask App
Classifies images into 6 categories: buildings, forest, glacier, mountain, sea, street using two pre-trained models — PyTorch (.pth) and Keras/TensorFlow (.keras).
Project structure
App-project/
├── rosly_mamekem_model.pth ← original model files (kept here as backup)
├── rosly_mamekem_model.keras
└── flask_app/
├── app.py ← Flask server (inference + routes)
├── requirements.txt
├── Procfile ← for Render / Railway
├── README.md
├── models/
│ ├── rosly_mamekem_model.pth
│ └── rosly_mamekem_model.keras
└── templates/
└── index.html ← full frontend (HTML + Tailwind + JS)Run locally
1. Create a virtual environment
cd flask_app
python3 -m venv venv2. Activate it
# Linux / Mac
source venv/bin/activate
# Windows
venv\Scripts\activate3. Install dependencies
pip install -r requirements.txtPyTorch only (lighter): if you don't need TensorFlow, this is enough. TensorFlow is optional — the app still works with just PyTorch.
4. Run
python app.pyOpen http://localhost:5000 in your browser.
Enable auto-reload during development
FLASK_DEBUG=true python app.pyDeploy on Hugging Face Spaces (Docker)
Hugging Face Spaces is great for ML school projects — free, public URL, no credit card.
Steps
- Go to huggingface.co/spaces and click Create new Space.
- Fill in:
- Clone the Space repo locally:
git clone https://huggingface.co/spaces/YOUR_USERNAME/intel-image-classifier
cd intel-image-classifier- Copy the contents of
flask_app/into the cloned repo:
cp -r /path/to/flask_app/* .- Push everything:
git add .
git commit -m "deploy flask app"
git push- Hugging Face reads the
Dockerfileautomatically and builds the image. Your app will be live at:https://YOUR_USERNAME-intel-image-classifier.hf.space
The free tier may take 30-60 seconds to start on the first request (cold start). If the Space sleeps, just refresh the page and wait.
Deploy on Render (free — recommended for school)
- Push your project to a GitHub repo (include the
models/folder).
- Go to render.com → New → Web Service.
- Connect your repo and fill in:
- Click Deploy → you get a public URL like
https://your-app.onrender.com.
The free tier sleeps after 15 min of inactivity. First request after sleep takes ~30 s. Fine for a school demo.
Deploy on Railway (alternative)
- Go to railway.app → New Project → Deploy from GitHub.
- Select your repo, set Root Directory to
flask_app. - Railway reads the
Procfileautomatically. Done.
Notes
- TensorFlow is a large package (~500 MB). If you only need PyTorch, remove
tensorflowfromrequirements.txt. - The app handles the case where a model is not installed — it returns a clear error message instead of crashing.
- Models are trained on 64×64 images with 6 classes.
