How aps31012005-prog/task_10_docker_flask_api works
This repository provides a Flask API for CIFAR-10 image classification, with documented Docker deployment. The main workflow accepts an uploaded image, preprocesses it for the trained model, and returns a class and confidence as JSON; a separate health endpoint reports API availability. The sampled Flask source supports the inference and routing relationships shown. Docker behavior is described in the README, but its build and optimization steps are deployment practices rather than runtime components.
Main entry points: flask_api.py Prediction endpoint · cifar10_cnn.keras CIFAR-10 model
Components 9
API
- Flask application
flask_api.py - Health endpoint
flask_api.py - Prediction endpoint
flask_api.py - JSON response
flask_api.py
Inference
- Image preprocessing
flask_api.py - CIFAR-10 model
model/cifar10_cnn.keras - Class mapping
flask_api.py
Deployment
- Docker container
Other components
- API client
Connections 11
- API client → Docker container: sends request
- Docker container → Flask application: runs
- Flask application → Health endpoint: dispatches GET
- Flask application → Prediction endpoint: dispatches POST
- Prediction endpoint → Image preprocessing: prepares image
- Image preprocessing → CIFAR-10 model: submits batch
- CIFAR-10 model → Prediction endpoint: returns scores
- Prediction endpoint → Class mapping: maps index
- Health endpoint → JSON response: returns status
- Prediction endpoint → JSON response: returns prediction
- JSON response → API client: sends response