# dharicharan/ai-project-iitm architecture

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

- Interactive diagram: https://gitdiagram.com/dharicharan/ai-project-iitm
- Repository: https://github.com/dharicharan/ai-project-iitm

## Overview

This repository is a BERT-based multi-label emotion classifier with an interactive Gradio inference app. Its user workflow accepts text, tokenizes it, runs a fine-tuned model, and returns confidence scores for five emotions. The README also documents dataset preprocessing, baseline/LSTM experiments, and BERT training/inference notebooks; those are represented at the notebook-directory level because their contents were not sampled. App-level relationships are grounded in app.py; the unsampled notebook stages are not connected by speculative execution edges.

Main entry points: [`app.py`](https://github.com/dharicharan/ai-project-iitm/blob/main/app.py) (Gradio interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experiments["Model Development"]
  node_datasets["Train/test data"]
  node_preprocessing["Data analysis"]
  node_baselines["TF-IDF baseline"]
  node_lstm["LSTM modeling"]
  node_training["BERT training"]
  node_offline_inference["Submission inference"]
end

subgraph group_runtime["Inference Application"]
  node_webapp["Gradio interface<br/>[app.py]"]
  node_predictor["Emotion prediction<br/>[app.py]"]
  node_tokenizer["Text tokenizer<br/>[app.py]"]
  node_classifier["BERT classifier<br/>[app.py]"]
end

subgraph group_integrations["Model Services"]
  node_weights["Model weights"]
  node_hub["Hugging Face Hub"]
  node_bert_model["BERT pretrained model"]
end

node_user(("Text user"))

node_user -->|"enters text"| node_webapp
node_webapp -->|"dispatches"| node_predictor
node_predictor -->|"tokenizes text"| node_tokenizer
node_predictor -->|"runs inference"| node_classifier
node_classifier -->|"returns logits"| node_predictor
node_predictor -->|"returns scores"| node_webapp
node_classifier -->|"loads backbone"| node_bert_model
node_webapp -->|"downloads tokenizer"| node_hub
node_webapp -->|"loads weights"| node_weights
node_hub -->|"hosts weights"| node_weights

click node_datasets "https://github.com/dharicharan/ai-project-iitm/tree/main/data"
click node_preprocessing "https://github.com/dharicharan/ai-project-iitm/tree/main/notebook"
click node_baselines "https://github.com/dharicharan/ai-project-iitm/tree/main/notebook"
click node_lstm "https://github.com/dharicharan/ai-project-iitm/tree/main/notebook"
click node_training "https://github.com/dharicharan/ai-project-iitm/tree/main/notebook"
click node_offline_inference "https://github.com/dharicharan/ai-project-iitm/tree/main/notebook"
click node_webapp "https://github.com/dharicharan/ai-project-iitm/blob/main/app.py"
click node_predictor "https://github.com/dharicharan/ai-project-iitm/blob/main/app.py"
click node_tokenizer "https://github.com/dharicharan/ai-project-iitm/blob/main/app.py"
click node_classifier "https://github.com/dharicharan/ai-project-iitm/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_datasets,node_preprocessing,node_baselines,node_lstm,node_training,node_offline_inference,node_user toneBlue
class node_webapp,node_predictor,node_tokenizer,node_classifier toneAmber
class node_weights,node_hub,node_bert_model toneMint
```

## Components

### Model Development

- [Train/test data](https://github.com/dharicharan/ai-project-iitm/tree/main/data): `data`
- [Data analysis](https://github.com/dharicharan/ai-project-iitm/tree/main/notebook): `notebook`
- [TF-IDF baseline](https://github.com/dharicharan/ai-project-iitm/tree/main/notebook): `notebook`
- [LSTM modeling](https://github.com/dharicharan/ai-project-iitm/tree/main/notebook): `notebook`
- [BERT training](https://github.com/dharicharan/ai-project-iitm/tree/main/notebook): `notebook`
- [Submission inference](https://github.com/dharicharan/ai-project-iitm/tree/main/notebook): `notebook`

### Inference Application

- [Gradio interface](https://github.com/dharicharan/ai-project-iitm/blob/main/app.py): `app.py`
- [Emotion prediction](https://github.com/dharicharan/ai-project-iitm/blob/main/app.py): `app.py`
- [Text tokenizer](https://github.com/dharicharan/ai-project-iitm/blob/main/app.py): `app.py`
- [BERT classifier](https://github.com/dharicharan/ai-project-iitm/blob/main/app.py): `app.py`

### Model Services

- **Model weights**
- **Hugging Face Hub**
- **BERT pretrained model**

### Other components

- **Text user**

## Connections

- Text user → Gradio interface: enters text (evidence: `README.md`)
- Gradio interface → Emotion prediction: dispatches (evidence: `app.py`)
- Emotion prediction → Text tokenizer: tokenizes text (evidence: `app.py`)
- Emotion prediction → BERT classifier: runs inference (evidence: `app.py`)
- BERT classifier → Emotion prediction: returns logits (evidence: `app.py`)
- Emotion prediction → Gradio interface: returns scores (evidence: `app.py`)
- BERT classifier → BERT pretrained model: loads backbone (evidence: `app.py`)
- Gradio interface → Hugging Face Hub: downloads tokenizer (evidence: `app.py`)
- Gradio interface → Model weights: loads weights (evidence: `app.py`)
- Hugging Face Hub → Model weights: hosts weights (evidence: `README.md`)
