# neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection architecture

> Architecture diagram of the GitHub repository neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection
- Repository: https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection

## Overview

This is a webcam-based demographic advertising application. Its main workflow captures video, detects faces, predicts age and gender, records observations, and exposes live demographics and aggregated analytics through a Flask web interface. The app also loads ad configuration and supports filtered data and CSV export. The excerpts establish these runtime responsibilities, but do not show how selected ads are presented or how the HTML pages invoke the endpoints; those links are omitted. The prediction module is referenced by the app but absent from the supplied tree.

Main entry points: [`app.py`](https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/app.py) (Flask app), [`advertisement.db`](https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/advertisement.db) (Demographics store), [`ads.json`](https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/ads.json) (Ad configuration), [`index.html`](https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/index.html) (Home page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and inference"]
  node_flask["Flask app<br/>[app.py]"]
  node_prediction["Age/gender prediction"]
end

subgraph group_ads["Ad configuration"]
  node_ads_json["Ad configuration<br/>[ads.json]"]
end

subgraph group_web["Web interface"]
  node_home_page["Home page<br/>[index.html]"]
  node_dashboard_page["Dashboard page<br/>[dashboard.html]"]
end

subgraph group_analytics["Demographic analytics"]
  node_ad_database[("Demographics store<br/>[advertisement.db]")]
  node_live_demographics["Live demographics<br/>[app.py]"]
  node_analytics_api["Counts and filters<br/>[app.py]"]
  node_csv_export["CSV export<br/>[app.py]"]
end

node_browser(("Browser user"))
node_webcam(("Webcam"))

node_browser -->|"requests pages"| node_flask
node_flask -->|"renders"| node_home_page
node_flask -->|"renders"| node_dashboard_page
node_flask -->|"reads frames"| node_webcam
node_flask -->|"predicts demographics"| node_prediction
node_flask -->|"writes observations"| node_ad_database
node_flask -->|"loads ads"| node_ads_json
node_flask -->|"serves"| node_live_demographics
node_live_demographics -->|"returns JSON"| node_browser
node_analytics_api -->|"queries"| node_ad_database
node_flask -->|"serves"| node_analytics_api
node_analytics_api -->|"returns results"| node_browser
node_csv_export -->|"queries"| node_ad_database
node_flask -->|"serves"| node_csv_export
node_csv_export -->|"returns CSV"| node_browser

click node_flask "https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/app.py"
click node_ads_json "https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/ads.json"
click node_ad_database "https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/advertisement.db"
click node_home_page "https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/index.html"
click node_dashboard_page "https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/dashboard.html"
click node_live_demographics "https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/app.py"
click node_analytics_api "https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/app.py"
click node_csv_export "https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/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_flask,node_prediction,node_browser toneBlue
class node_ads_json toneAmber
class node_home_page,node_dashboard_page toneMint
class node_ad_database,node_live_demographics,node_analytics_api,node_csv_export toneRose
class node_webcam toneIndigo
```

## Components

### Capture and inference

- [Flask app](https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/app.py): `app.py`
- **Age/gender prediction**

### Ad configuration

- [Ad configuration](https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/ads.json): `ads.json`

### Web interface

- [Home page](https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/index.html): `index.html`
- [Dashboard page](https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/dashboard.html): `dashboard.html`

### Demographic analytics

- [Demographics store](https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/advertisement.db): `advertisement.db`
- [Live demographics](https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/app.py): `app.py`
- [Counts and filters](https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/app.py): `app.py`
- [CSV export](https://github.com/neeraja2303/advertisement-system-based-on-real-time-age-and-gender-detection/blob/main/app.py): `app.py`

### Other components

- **Browser user**
- **Webcam**

## Connections

- Browser user → Flask app: requests pages (evidence: `app.py`)
- Flask app → Home page: renders (evidence: `app.py`)
- Flask app → Dashboard page: renders (evidence: `app.py`)
- Flask app → Webcam: reads frames (evidence: `app.py`)
- Flask app → Age/gender prediction: predicts demographics (evidence: `app.py`)
- Flask app → Demographics store: writes observations (evidence: `app.py`)
- Flask app → Ad configuration: loads ads (evidence: `app.py`)
- Flask app → Live demographics: serves (evidence: `app.py`)
- Live demographics → Browser user: returns JSON (evidence: `app.py`)
- Counts and filters → Demographics store: queries (evidence: `app.py`)
- Flask app → Counts and filters: serves (evidence: `app.py`)
- Counts and filters → Browser user: returns results (evidence: `app.py`)
- CSV export → Demographics store: queries (evidence: `app.py`)
- Flask app → CSV export: serves (evidence: `app.py`)
- CSV export → Browser user: returns CSV (evidence: `app.py`)
