# venkatesh152003-ghub/emotion-detection-project architecture

> Architecture diagram of the GitHub repository venkatesh152003-ghub/emotion-detection-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/venkatesh152003-ghub/emotion-detection-project
- Repository: https://github.com/venkatesh152003-ghub/emotion-detection-project

## Overview

A Flask emotion-detection web app accepts text and returns an emotion prediction. The documented flow prioritizes keyword rules, then uses a trained neural model for unmatched text. The checked-in tree includes the CNN-BiGRU model, but not the tokenizer or label-encoder files that app.py loads, so deployment requires those artifacts separately. README capability descriptions conflict with the sampled implementation in places; the graph follows the sampled runtime and notes the documented UI and training roles without assuming unseen wiring.

Main entry points: [`app.py`](https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/app.py) (Flask routes), [`model.py`](https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/model.py) (Training pipeline), [`templates/index.html`](https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/templates/index.html) (Input and results page), [`cnn_bigru_model.h5`](https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/cnn_bigru_model.h5) (CNN-BiGRU model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_flask["Flask routes<br/>[app.py]"]
  node_page["Input and results page<br/>[index.html]"]
  node_styles["Page styling<br/>[style.css]"]
end

subgraph group_prediction["Prediction"]
  node_rule["Keyword rules<br/>[app.py]"]
  node_clean["Text cleaning<br/>[app.py]"]
  node_tokenizer["Tokenizer"]
  node_sequence["Sequence padding<br/>[app.py]"]
  node_network["CNN-BiGRU model<br/>[cnn_bigru_model.h5]"]
  node_decode["Emotion decoding"]
end

subgraph group_training["Model training"]
  node_dataset["Training dataset"]
  node_training["Training pipeline<br/>[model.py]"]
end

node_user(("Text user"))

node_user -->|"enters text"| node_page
node_page -.->|"submits text"| node_flask
node_flask -->|"renders page"| node_page
node_page -.->|"uses styles"| node_styles
node_flask -->|"checks keywords"| node_rule
node_flask -->|"cleans fallback text"| node_clean
node_flask -->|"loads and tokenizes"| node_tokenizer
node_flask -->|"pads sequences"| node_sequence
node_flask -->|"predicts with"| node_network
node_flask -->|"decodes class"| node_decode
node_dataset -.->|"provides examples"| node_training
node_training -->|"trains and saves"| node_network
node_training -->|"fits and saves"| node_tokenizer
node_training -->|"fits and saves encoder"| node_decode

click node_flask "https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/app.py"
click node_page "https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/templates/index.html"
click node_styles "https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/Static/style.css"
click node_rule "https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/app.py"
click node_clean "https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/app.py"
click node_sequence "https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/app.py"
click node_network "https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/cnn_bigru_model.h5"
click node_training "https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/model.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_page,node_styles,node_user toneBlue
class node_rule,node_clean,node_tokenizer,node_sequence,node_network,node_decode toneAmber
class node_dataset,node_training toneMint
```

## Components

### Web interface

- [Flask routes](https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/app.py): `app.py`
- [Input and results page](https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/templates/index.html): `templates/index.html`
- [Page styling](https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/Static/style.css): `Static/style.css`

### Prediction

- [Keyword rules](https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/app.py): `app.py`
- [Text cleaning](https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/app.py): `app.py`
- **Tokenizer**
- [Sequence padding](https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/app.py): `app.py`
- [CNN-BiGRU model](https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/cnn_bigru_model.h5): `cnn_bigru_model.h5`
- **Emotion decoding**

### Model training

- **Training dataset**
- [Training pipeline](https://github.com/venkatesh152003-ghub/emotion-detection-project/blob/main/model.py): `model.py`

### Other components

- **Text user**

## Connections

- Text user → Input and results page: enters text (evidence: `README.md`)
- Input and results page → Flask routes: submits text
- Flask routes → Input and results page: renders page (evidence: `app.py`)
- Input and results page → Page styling: uses styles
- Flask routes → Keyword rules: checks keywords (evidence: `app.py`)
- Flask routes → Text cleaning: cleans fallback text (evidence: `app.py`)
- Flask routes → Tokenizer: loads and tokenizes (evidence: `app.py`)
- Flask routes → Sequence padding: pads sequences (evidence: `app.py`)
- Flask routes → CNN-BiGRU model: predicts with (evidence: `app.py`)
- Flask routes → Emotion decoding: decodes class (evidence: `app.py`)
- Training dataset → Training pipeline: provides examples
- Training pipeline → CNN-BiGRU model: trains and saves (evidence: `model.py`)
- Training pipeline → Tokenizer: fits and saves (evidence: `model.py`)
- Training pipeline → Emotion decoding: fits and saves encoder (evidence: `model.py`)
