# akashk1546/ml-based-cyberbullying-detection architecture

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

- Interactive diagram: https://gitdiagram.com/akashk1546/ml-based-cyberbullying-detection
- Repository: https://github.com/akashk1546/ml-based-cyberbullying-detection

## Overview

This is a Flask-based social app with machine-learning cyberbullying moderation. The principal flow is a user submitting a post or comment, the app scoring its text and/or image, and the app persisting moderation results for display. Social features include accounts, feeds, search, likes, sharing, follows, and privacy controls. The graph reflects only shown excerpts and explicit references; several routes and persistence details are not sampled, so uncertain links are omitted.

Main entry points: [`app.py`](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py) (Flask application), [`ml.py`](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/ml.py) (Model inference), [`emoji_analysis.py`](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/emoji_analysis.py) (Emoji analysis), [`static/js/app.js`](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/static/js/app.js) (Browser interactions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_browser["Browser interactions<br/>[app.js]"]
  node_pages["Rendered pages"]
end

subgraph group_social["Social product"]
  node_app["Flask application<br/>[app.py]"]
  node_database[("SQLite database<br/>[app.py]")]
  node_media[("Uploaded media")]
  node_accounts["Accounts and settings<br/>[app.py]"]
  node_feed["Posts and feeds<br/>[app.py]"]
  node_social_actions["Likes and follows<br/>[app.py]"]
  node_search["Search and discovery<br/>[app.py]"]
end

subgraph group_moderation["Content moderation"]
  node_post_analysis["Post moderation<br/>[app.py]"]
  node_comment_analysis["Comment moderation<br/>[app.py]"]
  node_ml["Model inference<br/>[ml.py]"]
  node_text_model["Toxicity scoring<br/>[ml.py]"]
  node_ocr["Image text OCR<br/>[ml.py]"]
  node_clip["Image classification<br/>[ml.py]"]
  node_emoji["Emoji analysis<br/>[emoji_analysis.py]"]
end

node_user(("User"))

node_user -.->|"uses"| node_browser
node_browser -->|"posts requests"| node_app
node_app -->|"renders"| node_pages
node_app -->|"reads and writes"| node_database
node_app -->|"handles account flows"| node_accounts
node_app -->|"handles post flows"| node_feed
node_app -->|"handles actions"| node_social_actions
node_app -->|"queries and renders"| node_search
node_app -->|"analyzes posts"| node_post_analysis
node_app -->|"scores comments"| node_comment_analysis
node_post_analysis -->|"ensures models"| node_ml
node_post_analysis -->|"extracts image text"| node_ocr
node_post_analysis -->|"scores text"| node_text_model
node_post_analysis -->|"classifies image"| node_clip
node_post_analysis -->|"combines emoji signals"| node_emoji
node_comment_analysis -->|"ensures models"| node_ml
node_comment_analysis -->|"scores comment"| node_text_model
node_comment_analysis -->|"raises risk score"| node_emoji
node_ml -->|"runs inference"| node_text_model
node_ml -->|"runs OCR"| node_ocr
node_ml -->|"runs classification"| node_clip
node_ml -->|"uses emoji labels"| node_emoji

click node_browser "https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/static/js/app.js"
click node_pages "https://github.com/akashk1546/ml-based-cyberbullying-detection/tree/main/templates"
click node_app "https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py"
click node_database "https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py"
click node_media "https://github.com/akashk1546/ml-based-cyberbullying-detection/tree/main/static/uploads"
click node_accounts "https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py"
click node_feed "https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py"
click node_social_actions "https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py"
click node_search "https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py"
click node_post_analysis "https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py"
click node_comment_analysis "https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py"
click node_ml "https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/ml.py"
click node_text_model "https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/ml.py"
click node_ocr "https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/ml.py"
click node_clip "https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/ml.py"
click node_emoji "https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/emoji_analysis.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_browser,node_pages,node_user toneBlue
class node_app,node_database,node_media,node_accounts,node_feed,node_social_actions,node_search toneAmber
class node_post_analysis,node_comment_analysis,node_ml,node_text_model,node_ocr,node_clip,node_emoji toneMint
```

## Components

### Web experience

- [Browser interactions](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/static/js/app.js): `static/js/app.js`
- [Rendered pages](https://github.com/akashk1546/ml-based-cyberbullying-detection/tree/main/templates): `templates`

### Social product

- [Flask application](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py): `app.py`
- [SQLite database](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py): `app.py`
- [Uploaded media](https://github.com/akashk1546/ml-based-cyberbullying-detection/tree/main/static/uploads): `static/uploads`
- [Accounts and settings](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py): `app.py`
- [Posts and feeds](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py): `app.py`
- [Likes and follows](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py): `app.py`
- [Search and discovery](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py): `app.py`

### Content moderation

- [Post moderation](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py): `app.py`
- [Comment moderation](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/app.py): `app.py`
- [Model inference](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/ml.py): `ml.py`
- [Toxicity scoring](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/ml.py): `ml.py`
- [Image text OCR](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/ml.py): `ml.py`
- [Image classification](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/ml.py): `ml.py`
- [Emoji analysis](https://github.com/akashk1546/ml-based-cyberbullying-detection/blob/main/emoji_analysis.py): `emoji_analysis.py`

### Other components

- **User**

## Connections

- User → Browser interactions: uses
- Browser interactions → Flask application: posts requests (evidence: `static/js/app.js`)
- Flask application → Rendered pages: renders (evidence: `app.py`)
- Flask application → SQLite database: reads and writes (evidence: `app.py`)
- Flask application → Accounts and settings: handles account flows (evidence: `app.py`)
- Flask application → Posts and feeds: handles post flows (evidence: `app.py`)
- Flask application → Likes and follows: handles actions (evidence: `app.py`)
- Flask application → Search and discovery: queries and renders (evidence: `app.py`)
- Flask application → Post moderation: analyzes posts (evidence: `app.py`)
- Flask application → Comment moderation: scores comments (evidence: `app.py`)
- Post moderation → Model inference: ensures models (evidence: `app.py`)
- Post moderation → Image text OCR: extracts image text (evidence: `app.py`)
- Post moderation → Toxicity scoring: scores text (evidence: `app.py`)
- Post moderation → Image classification: classifies image (evidence: `app.py`)
- Post moderation → Emoji analysis: combines emoji signals (evidence: `app.py`)
- Comment moderation → Model inference: ensures models (evidence: `app.py`)
- Comment moderation → Toxicity scoring: scores comment (evidence: `app.py`)
- Comment moderation → Emoji analysis: raises risk score (evidence: `app.py`)
- Model inference → Toxicity scoring: runs inference (evidence: `ml.py`)
- Model inference → Image text OCR: runs OCR (evidence: `ml.py`)
- Model inference → Image classification: runs classification (evidence: `ml.py`)
- Model inference → Emoji analysis: uses emoji labels (evidence: `ml.py`)
