# yasha-2006/fake_news_detection architecture

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

- Interactive diagram: https://gitdiagram.com/yasha-2006/fake_news_detection
- Repository: https://github.com/yasha-2006/fake_news_detection

## Overview

This is a small Flask fake-news text classifier. A user opens the prediction page, submits a headline, and the app preprocesses it, applies the saved TF-IDF vectorizer and classifier, then displays a “looking real” or “looking fake” label. The repository also includes training and test CSVs, but the README says the web app loads saved artifacts rather than training at startup. The workflow is based on the README and the excerpted app.py; template internals were not sampled.

Main entry points: [`app.py`](https://github.com/yasha-2006/fake_news_detection/blob/main/app.py) (Flask routes), [`templates/prediction.html`](https://github.com/yasha-2006/fake_news_detection/blob/main/templates/prediction.html) (Prediction page), [`templates/index.html`](https://github.com/yasha-2006/fake_news_detection/blob/main/templates/index.html) (Landing page), [`tfidf_vectorizer.pkl`](https://github.com/yasha-2006/fake_news_detection/blob/main/tfidf_vectorizer.pkl) (TF-IDF vectorizer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_flask["Flask routes<br/>[app.py]"]
  node_landing["Landing page<br/>[index.html]"]
  node_prediction_page["Prediction page<br/>[prediction.html]"]
end

subgraph group_inference["Prediction workflow"]
  node_preprocessing["Text preprocessing<br/>[app.py]"]
  node_label_mapping["Label mapping<br/>[app.py]"]
end

subgraph group_assets["Model assets"]
  node_vectorizer["TF-IDF vectorizer"]
  node_classifier["Saved classifier<br/>[model.pkl]"]
  node_dataset[("CSV datasets<br/>[train.csv]")]
end

node_user(("User"))

node_user -->|"submits headline"| node_flask
node_flask -->|"renders"| node_landing
node_flask -->|"renders"| node_prediction_page
node_flask -->|"calls"| node_preprocessing
node_preprocessing -->|"transforms text"| node_vectorizer
node_preprocessing -->|"predicts label"| node_classifier
node_flask -->|"maps prediction"| node_label_mapping
node_flask -->|"renders result"| node_prediction_page

click node_flask "https://github.com/yasha-2006/fake_news_detection/blob/main/app.py"
click node_landing "https://github.com/yasha-2006/fake_news_detection/blob/main/templates/index.html"
click node_prediction_page "https://github.com/yasha-2006/fake_news_detection/blob/main/templates/prediction.html"
click node_preprocessing "https://github.com/yasha-2006/fake_news_detection/blob/main/app.py"
click node_vectorizer "https://github.com/yasha-2006/fake_news_detection/blob/main/tfidf_vectorizer.pkl"
click node_classifier "https://github.com/yasha-2006/fake_news_detection/blob/main/model.pkl"
click node_label_mapping "https://github.com/yasha-2006/fake_news_detection/blob/main/app.py"
click node_dataset "https://github.com/yasha-2006/fake_news_detection/blob/main/Dataset/train.csv"

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_landing,node_prediction_page,node_user toneBlue
class node_preprocessing,node_label_mapping toneAmber
class node_vectorizer,node_classifier,node_dataset toneMint
```

## Components

### Web interface

- [Flask routes](https://github.com/yasha-2006/fake_news_detection/blob/main/app.py): `app.py`
- [Landing page](https://github.com/yasha-2006/fake_news_detection/blob/main/templates/index.html): `templates/index.html`
- [Prediction page](https://github.com/yasha-2006/fake_news_detection/blob/main/templates/prediction.html): `templates/prediction.html`

### Prediction workflow

- [Text preprocessing](https://github.com/yasha-2006/fake_news_detection/blob/main/app.py): `app.py`
- [Label mapping](https://github.com/yasha-2006/fake_news_detection/blob/main/app.py): `app.py`

### Model assets

- [TF-IDF vectorizer](https://github.com/yasha-2006/fake_news_detection/blob/main/tfidf_vectorizer.pkl): `tfidf_vectorizer.pkl`
- [Saved classifier](https://github.com/yasha-2006/fake_news_detection/blob/main/model.pkl): `model.pkl`
- [CSV datasets](https://github.com/yasha-2006/fake_news_detection/blob/main/Dataset/train.csv): `Dataset/train.csv`

### Other components

- **User**

## Connections

- User → Flask routes: submits headline (evidence: `README.md`)
- Flask routes → Landing page: renders (evidence: `app.py`)
- Flask routes → Prediction page: renders (evidence: `app.py`)
- Flask routes → Text preprocessing: calls (evidence: `app.py`)
- Text preprocessing → TF-IDF vectorizer: transforms text (evidence: `app.py`)
- Text preprocessing → Saved classifier: predicts label (evidence: `app.py`)
- Flask routes → Label mapping: maps prediction (evidence: `app.py`)
- Flask routes → Prediction page: renders result (evidence: `app.py`)
