# senbenz/test_inference-images architecture

> Architecture diagram of the GitHub repository senbenz/test_inference-images, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/senbenz/test_inference-images
- Repository: https://github.com/senbenz/test_inference-images

## Overview

iris-docker is a small Iris classification service. Its workflow trains a Random Forest model, saves it as a joblib artifact, and serves single-sample and batch predictions through FastAPI; the single-prediction route also increments a Redis counter, which a separate route reads. The README documents local and Docker-based operation, but the Docker configuration was not sampled, so deployment details and wiring are omitted.

Main entry points: [`train.py`](https://github.com/senbenz/test_inference-images/blob/main/train.py) (Model trainer), [`serve.py`](https://github.com/senbenz/test_inference-images/blob/main/serve.py) (FastAPI service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Model training"]
  node_trainer["Model trainer<br/>[train.py]"]
  node_model["Joblib model"]
end

subgraph group_inference["Inference API"]
  node_api["FastAPI service<br/>[serve.py]"]
  node_single["Single prediction<br/>[serve.py]"]
  node_batch["Batch prediction<br/>[serve.py]"]
  node_health["Health check<br/>[serve.py]"]
end

subgraph group_state["Request state"]
  node_counter_route["Counter route<br/>[serve.py]"]
  node_redis[("Redis counter")]
end

node_operator(("Operator"))
node_iris_data["Iris dataset"]
node_client(("API client"))

node_operator -->|"runs training"| node_trainer
node_trainer -->|"loads dataset"| node_iris_data
node_trainer -->|"saves model"| node_model
node_operator -->|"starts service"| node_api
node_api -->|"loads model"| node_model
node_client -->|"requests prediction"| node_single
node_client -->|"requests predictions"| node_batch
node_client -->|"checks health"| node_health
node_single -->|"increments counter"| node_redis
node_counter_route -->|"reads counter"| node_redis

click node_trainer "https://github.com/senbenz/test_inference-images/blob/main/train.py"
click node_api "https://github.com/senbenz/test_inference-images/blob/main/serve.py"
click node_single "https://github.com/senbenz/test_inference-images/blob/main/serve.py"
click node_batch "https://github.com/senbenz/test_inference-images/blob/main/serve.py"
click node_health "https://github.com/senbenz/test_inference-images/blob/main/serve.py"
click node_counter_route "https://github.com/senbenz/test_inference-images/blob/main/serve.py"

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_trainer,node_model,node_client toneBlue
class node_api,node_single,node_batch,node_health toneAmber
class node_counter_route,node_redis toneMint
class node_operator,node_iris_data toneIndigo
```

## Components

### Model training

- [Model trainer](https://github.com/senbenz/test_inference-images/blob/main/train.py): `train.py`
- **Joblib model**

### Inference API

- [FastAPI service](https://github.com/senbenz/test_inference-images/blob/main/serve.py): `serve.py`
- [Single prediction](https://github.com/senbenz/test_inference-images/blob/main/serve.py): `serve.py`
- [Batch prediction](https://github.com/senbenz/test_inference-images/blob/main/serve.py): `serve.py`
- [Health check](https://github.com/senbenz/test_inference-images/blob/main/serve.py): `serve.py`

### Request state

- [Counter route](https://github.com/senbenz/test_inference-images/blob/main/serve.py): `serve.py`
- **Redis counter**

### Other components

- **Operator**
- **Iris dataset**
- **API client**

## Connections

- Operator → Model trainer: runs training (evidence: `README.md`)
- Model trainer → Iris dataset: loads dataset (evidence: `train.py`)
- Model trainer → Joblib model: saves model (evidence: `train.py`)
- Operator → FastAPI service: starts service (evidence: `README.md`)
- FastAPI service → Joblib model: loads model (evidence: `serve.py`)
- API client → Single prediction: requests prediction (evidence: `serve.py`)
- API client → Batch prediction: requests predictions (evidence: `serve.py`)
- API client → Health check: checks health (evidence: `serve.py`)
- Single prediction → Redis counter: increments counter (evidence: `serve.py`)
- Counter route → Redis counter: reads counter (evidence: `serve.py`)
