# tankalanagaraju/historical-photo-colorization-using-ai architecture

> Architecture diagram of the GitHub repository tankalanagaraju/historical-photo-colorization-using-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tankalanagaraju/historical-photo-colorization-using-ai
- Repository: https://github.com/tankalanagaraju/historical-photo-colorization-using-ai

## Overview

This is a Streamlit web app for turning grayscale photos into downloadable colorized images. Users upload an image or choose a sample; the app checks that it is grayscale, runs Caffe-based colorization, displays the result, and offers a PNG download. The inference stages are implemented together in `colorizer()` in `app.py`. The tree does not include the `Input_images` directory referenced by the sample-image selector, so that path is not represented as a repository component.

Main entry points: [`app.py`](https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/app.py) (Colorizer), [`models/models_colorization_deploy_v2.prototxt`](https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/models/models_colorization_deploy_v2.prototxt) (Caffe config), [`models/colorization_release_v2.caffemodel`](https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/models/colorization_release_v2.caffemodel) (CNN weights), [`models/pts_in_hull.npy`](https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/models/pts_in_hull.npy) (Color points)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User interaction"]
  node_ui["Image interface<br/>[app.py]"]
  node_input["Image input<br/>[app.py]"]
  node_validation["Grayscale check<br/>[app.py]"]
  node_download["PNG download<br/>[app.py]"]
end

subgraph group_colorization["Colorization pipeline"]
  node_colorizer["Colorizer<br/>[app.py]"]
  node_opencv["OpenCV DNN"]
end

subgraph group_assets["Model assets"]
  node_prototxt["Caffe config"]
  node_caffemodel["CNN weights"]
  node_points["Color points<br/>[pts_in_hull.npy]"]
end

node_user(("User"))

node_user -->|"uses"| node_ui
node_ui -->|"accepts image"| node_input
node_input -->|"provides image"| node_validation
node_ui -->|"checks image"| node_validation
node_validation -->|"colorizes grayscale"| node_colorizer
node_colorizer -->|"runs inference"| node_opencv
node_colorizer -->|"loads config"| node_prototxt
node_colorizer -->|"loads weights"| node_caffemodel
node_colorizer -->|"loads points"| node_points
node_ui -->|"offers result"| node_download
node_colorizer -->|"returns image"| node_download
node_user -->|"downloads PNG"| node_download

click node_ui "https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/app.py"
click node_input "https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/app.py"
click node_validation "https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/app.py"
click node_colorizer "https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/app.py"
click node_prototxt "https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/models/models_colorization_deploy_v2.prototxt"
click node_caffemodel "https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/models/colorization_release_v2.caffemodel"
click node_points "https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/models/pts_in_hull.npy"
click node_download "https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/app.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_ui,node_input,node_validation,node_download,node_user toneBlue
class node_colorizer,node_opencv toneAmber
class node_prototxt,node_caffemodel,node_points toneMint
```

## Components

### User interaction

- [Image interface](https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/app.py): `app.py`
- [Image input](https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/app.py): `app.py`
- [Grayscale check](https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/app.py): `app.py`
- [PNG download](https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/app.py): `app.py`

### Colorization pipeline

- [Colorizer](https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/app.py): `app.py`
- **OpenCV DNN**

### Model assets

- [Caffe config](https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/models/models_colorization_deploy_v2.prototxt): `models/models_colorization_deploy_v2.prototxt`
- [CNN weights](https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/models/colorization_release_v2.caffemodel): `models/colorization_release_v2.caffemodel`
- [Color points](https://github.com/tankalanagaraju/historical-photo-colorization-using-ai/blob/main/models/pts_in_hull.npy): `models/pts_in_hull.npy`

### Other components

- **User**

## Connections

- User → Image interface: uses
- Image interface → Image input: accepts image
- Image input → Grayscale check: provides image
- Image interface → Grayscale check: checks image
- Grayscale check → Colorizer: colorizes grayscale
- Colorizer → OpenCV DNN: runs inference
- Colorizer → Caffe config: loads config
- Colorizer → CNN weights: loads weights
- Colorizer → Color points: loads points
- Image interface → PNG download: offers result
- Colorizer → PNG download: returns image
- User → PNG download: downloads PNG
