# maminiaina-tech/mamiloko-vision architecture

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

- Interactive diagram: https://gitdiagram.com/maminiaina-tech/mamiloko-vision
- Repository: https://github.com/maminiaina-tech/mamiloko-vision

## Overview

MamiLoko Vision is a Streamlit application for image retouching and perceptual color analysis. The user uploads an image; the app loads and resizes it, then offers a live retouching path and a separate analysis path. Analysis converts pixels to LAB, samples them, selects or accepts K, clusters, estimates color proportions, names colors, and reconstructs a segmented image; results are displayed and exported. Histogram comparison supports the retouching workflow. Some UI wiring is omitted from the excerpts, so the graph avoids uncertain connections.

Main entry points: [`color_analyzer.py`](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/color_analyzer.py) (Analysis workflow), [`app.py`](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/app.py) (App workflow), [`result_renderer.py`](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/result_renderer.py) (Results UI), [`image_processor.py`](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/image_processor.py) (Image processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Streamlit interface"]
  node_app["App workflow<br/>[app.py]"]
  node_renderer["Results UI<br/>[result_renderer.py]"]
  node_styles["UI styling<br/>[styles.py]"]
end

subgraph group_retouch["Image retouching"]
  node_editor["Image editor<br/>[image_editor.py]"]
  node_histogram["Histogram analysis"]
end

subgraph group_analysis["Color analysis"]
  node_image["Image processing<br/>[image_processor.py]"]
  node_analyzer["Analysis workflow<br/>[color_analyzer.py]"]
  node_color["Color conversion<br/>[color_processor.py]"]
  node_cluster["KMeans clustering"]
end

subgraph group_shared["Shared data"]
  node_models["Analysis results<br/>[models.py]"]
  node_constants["Analysis settings<br/>[constants.py]"]
end

node_user(("Image user"))

node_user -->|"uploads image"| node_app
node_app -->|"injects CSS"| node_styles
node_app -->|"loads image"| node_image
node_app -->|"requests analysis"| node_analyzer
node_app -->|"applies adjustments"| node_editor
node_app -->|"renders interface"| node_renderer
node_image -->|"provides pixels"| node_analyzer
node_analyzer -->|"samples and rebuilds"| node_image
node_analyzer -->|"converts colors"| node_color
node_analyzer -->|"fits and predicts"| node_cluster
node_analyzer -->|"creates results"| node_models
node_analyzer -->|"reads parameters"| node_constants
node_cluster -->|"reads cluster bounds"| node_constants
node_renderer -->|"computes comparisons"| node_histogram
node_renderer -->|"displays and exports"| node_models
node_renderer -->|"shows results"| node_user

click node_app "https://github.com/maminiaina-tech/mamiloko-vision/blob/main/app.py"
click node_renderer "https://github.com/maminiaina-tech/mamiloko-vision/blob/main/result_renderer.py"
click node_styles "https://github.com/maminiaina-tech/mamiloko-vision/blob/main/styles.py"
click node_editor "https://github.com/maminiaina-tech/mamiloko-vision/blob/main/image_editor.py"
click node_histogram "https://github.com/maminiaina-tech/mamiloko-vision/blob/main/histogram_processor.py"
click node_image "https://github.com/maminiaina-tech/mamiloko-vision/blob/main/image_processor.py"
click node_analyzer "https://github.com/maminiaina-tech/mamiloko-vision/blob/main/color_analyzer.py"
click node_color "https://github.com/maminiaina-tech/mamiloko-vision/blob/main/color_processor.py"
click node_cluster "https://github.com/maminiaina-tech/mamiloko-vision/blob/main/clustering_service.py"
click node_models "https://github.com/maminiaina-tech/mamiloko-vision/blob/main/models.py"
click node_constants "https://github.com/maminiaina-tech/mamiloko-vision/blob/main/constants.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_app,node_renderer,node_styles,node_user toneBlue
class node_editor,node_histogram toneAmber
class node_image,node_analyzer,node_color,node_cluster toneMint
class node_models,node_constants toneRose
```

## Components

### Streamlit interface

- [App workflow](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/app.py): `app.py`
- [Results UI](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/result_renderer.py): `result_renderer.py`
- [UI styling](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/styles.py): `styles.py`

### Image retouching

- [Image editor](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/image_editor.py): `image_editor.py`
- [Histogram analysis](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/histogram_processor.py): `histogram_processor.py`

### Color analysis

- [Image processing](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/image_processor.py): `image_processor.py`
- [Analysis workflow](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/color_analyzer.py): `color_analyzer.py`
- [Color conversion](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/color_processor.py): `color_processor.py`
- [KMeans clustering](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/clustering_service.py): `clustering_service.py`

### Shared data

- [Analysis results](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/models.py): `models.py`
- [Analysis settings](https://github.com/maminiaina-tech/mamiloko-vision/blob/main/constants.py): `constants.py`

### Other components

- **Image user**

## Connections

- Image user → App workflow: uploads image
- App workflow → UI styling: injects CSS
- App workflow → Image processing: loads image
- App workflow → Analysis workflow: requests analysis
- App workflow → Image editor: applies adjustments
- App workflow → Results UI: renders interface
- Image processing → Analysis workflow: provides pixels
- Analysis workflow → Image processing: samples and rebuilds
- Analysis workflow → Color conversion: converts colors
- Analysis workflow → KMeans clustering: fits and predicts
- Analysis workflow → Analysis results: creates results
- Analysis workflow → Analysis settings: reads parameters
- KMeans clustering → Analysis settings: reads cluster bounds
- Results UI → Histogram analysis: computes comparisons
- Results UI → Analysis results: displays and exports
- Results UI → Image user: shows results
