# aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management architecture

> Architecture diagram of the GitHub repository aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management
- Repository: https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management

## Overview

This repository combines a Streamlit image-classification interface with a Flask prediction API and a Dockerized deployment. The principal workflow is image upload, HTTP transfer, CIFAR-10 preprocessing and inference, then displaying the returned class and confidence. The README also documents container lifecycle and networking; deployment links reflect that documentation, while unshown Docker internals are omitted.

Main entry points: [`pages/1_Image_Prediction.py`](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/pages/1_Image_Prediction.py) (Prediction page), [`flask_api.py`](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/flask_api.py) (Prediction endpoint), [`model/cifar10_cnn.keras`](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/model/cifar10_cnn.keras) (CNN classifier), [`app.py`](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/app.py) (Model overview)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Streamlit interface"]
  node_dashboard["Model overview<br/>[app.py]"]
  node_prediction_page["Prediction page"]
  node_upload_preview["Image preview"]
  node_status_check["API status check"]
end

subgraph group_api["Prediction API"]
  node_api_service["Flask API<br/>[flask_api.py]"]
  node_health_endpoint["Health endpoint<br/>[flask_api.py]"]
  node_predict_endpoint["Prediction endpoint<br/>[flask_api.py]"]
  node_image_preprocessing["Image preprocessing<br/>[flask_api.py]"]
  node_classifier["CNN classifier<br/>[cifar10_cnn.keras]"]
  node_class_mapping["Class mapping<br/>[flask_api.py]"]
  node_prediction_result["Prediction result<br/>[flask_api.py]"]
end

subgraph group_deployment["Container runtime"]
  node_docker_engine["Docker Engine"]
  node_dockerfile["Container definition"]
  node_container["Running container"]
end

node_user(("Image uploader"))
node_docker_cli(("Docker CLI"))

node_user -->|"uploads image"| node_prediction_page
node_prediction_page -->|"displays image"| node_upload_preview
node_prediction_page -->|"checks status"| node_status_check
node_status_check -->|"GET request"| node_api_service
node_api_service -->|"dispatches"| node_health_endpoint
node_prediction_page -->|"POSTs image"| node_predict_endpoint
node_api_service -->|"dispatches"| node_predict_endpoint
node_predict_endpoint -->|"preprocesses image"| node_image_preprocessing
node_predict_endpoint -->|"runs inference"| node_classifier
node_predict_endpoint -->|"maps class index"| node_class_mapping
node_predict_endpoint -->|"returns JSON"| node_prediction_result
node_prediction_page -->|"receives JSON"| node_prediction_result
node_prediction_page -->|"shows result"| node_user
node_dashboard -->|"loads model"| node_classifier
node_docker_cli -->|"manages containers"| node_docker_engine
node_dockerfile -->|"configures runtime"| node_container
node_docker_engine -->|"runs image"| node_container
node_container -->|"hosts API"| node_api_service

click node_dashboard "https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/app.py"
click node_prediction_page "https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/pages/1_Image_Prediction.py"
click node_upload_preview "https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/pages/1_Image_Prediction.py"
click node_status_check "https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/pages/1_Image_Prediction.py"
click node_api_service "https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/flask_api.py"
click node_health_endpoint "https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/flask_api.py"
click node_predict_endpoint "https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/flask_api.py"
click node_image_preprocessing "https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/flask_api.py"
click node_classifier "https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/model/cifar10_cnn.keras"
click node_class_mapping "https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/flask_api.py"
click node_prediction_result "https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/flask_api.py"
click node_dockerfile "https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/Dockerfile"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard,node_prediction_page,node_upload_preview,node_status_check toneBlue
class node_api_service,node_health_endpoint,node_predict_endpoint,node_image_preprocessing,node_classifier,node_class_mapping,node_prediction_result toneAmber
class node_docker_engine,node_dockerfile,node_container toneMint
class node_user,node_docker_cli toneIndigo
```

## Components

### Streamlit interface

- [Model overview](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/app.py): `app.py`
- [Prediction page](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/pages/1_Image_Prediction.py): `pages/1_Image_Prediction.py`
- [Image preview](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/pages/1_Image_Prediction.py): `pages/1_Image_Prediction.py`
- [API status check](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/pages/1_Image_Prediction.py): `pages/1_Image_Prediction.py`

### Prediction API

- [Flask API](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/flask_api.py): `flask_api.py`
- [Health endpoint](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/flask_api.py): `flask_api.py`
- [Prediction endpoint](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/flask_api.py): `flask_api.py`
- [Image preprocessing](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/flask_api.py): `flask_api.py`
- [CNN classifier](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/model/cifar10_cnn.keras): `model/cifar10_cnn.keras`
- [Class mapping](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/flask_api.py): `flask_api.py`
- [Prediction result](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/flask_api.py): `flask_api.py`

### Container runtime

- **Docker Engine**
- [Container definition](https://github.com/aps31012005-prog/task_9_docker_fundamentals_and_container_lifecycle_management/blob/main/Dockerfile): `Dockerfile`
- **Running container**

### Other components

- **Image uploader**
- **Docker CLI**

## Connections

- Image uploader → Prediction page: uploads image
- Prediction page → Image preview: displays image
- Prediction page → API status check: checks status
- API status check → Flask API: GET request
- Flask API → Health endpoint: dispatches
- Prediction page → Prediction endpoint: POSTs image
- Flask API → Prediction endpoint: dispatches
- Prediction endpoint → Image preprocessing: preprocesses image
- Prediction endpoint → CNN classifier: runs inference
- Prediction endpoint → Class mapping: maps class index
- Prediction endpoint → Prediction result: returns JSON
- Prediction page → Prediction result: receives JSON
- Prediction page → Image uploader: shows result
- Model overview → CNN classifier: loads model
- Docker CLI → Docker Engine: manages containers
- Container definition → Running container: configures runtime
- Docker Engine → Running container: runs image
- Running container → Flask API: hosts API
