# sourabh-2610/truthlens architecture

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

- Interactive diagram: https://gitdiagram.com/sourabh-2610/truthlens
- Repository: https://github.com/sourabh-2610/truthlens

## Overview

TruthLens is a web application for analyzing news and presenting results. The visible client code supports image selection, camera capture, authentication forms, recent analyses, and result display; model training is implemented separately using labeled news datasets. The Flask application is a substantial but unsampled part of the repository, so its internal routes and connections to the client or model cannot be verified here. The graph therefore shows only relationships evidenced by the available excerpts.

Main entry points: [`static/JS/app.js`](https://github.com/sourabh-2610/truthlens/blob/master/static/JS/app.js) (Browser interface), [`train.py`](https://github.com/sourabh-2610/truthlens/blob/master/train.py) (Training pipeline), [`Fake.csv`](https://github.com/sourabh-2610/truthlens/blob/master/Fake.csv) (Fake news dataset), [`True.csv`](https://github.com/sourabh-2610/truthlens/blob/master/True.csv) (Real news dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web experience"]
  node_client["Browser interface<br/>[app.js]"]
  node_analysis_ui["Analysis results<br/>[app.js]"]
  node_history["Recent analyses<br/>[app.js]"]
  node_media["Image and camera input<br/>[app.js]"]
  node_auth["Authentication forms<br/>[app.js]"]
end

subgraph group_model["Detection model"]
  node_classifier["Classifier artifact<br/>[model.pkl]"]
  node_vectorizer["TF-IDF artifact<br/>[vectorizer.pkl]"]
end

subgraph group_training["Model training"]
  node_trainer["Training pipeline<br/>[train.py]"]
  node_fake_data["Fake news dataset<br/>[Fake.csv]"]
  node_real_data["Real news dataset<br/>[True.csv]"]
end

node_user(("User"))
node_server["Flask application<br/>[app.py]"]

node_user -->|"uses"| node_client
node_client -->|"selects or captures"| node_media
node_client -->|"opens forms"| node_auth
node_client -->|"renders recents"| node_history
node_client -->|"renders results"| node_analysis_ui
node_fake_data -->|"loads"| node_trainer
node_real_data -->|"loads"| node_trainer
node_trainer -->|"writes"| node_classifier
node_trainer -->|"writes"| node_vectorizer

click node_client "https://github.com/sourabh-2610/truthlens/blob/master/static/JS/app.js"
click node_analysis_ui "https://github.com/sourabh-2610/truthlens/blob/master/static/JS/app.js"
click node_history "https://github.com/sourabh-2610/truthlens/blob/master/static/JS/app.js"
click node_media "https://github.com/sourabh-2610/truthlens/blob/master/static/JS/app.js"
click node_auth "https://github.com/sourabh-2610/truthlens/blob/master/static/JS/app.js"
click node_server "https://github.com/sourabh-2610/truthlens/blob/master/app.py"
click node_trainer "https://github.com/sourabh-2610/truthlens/blob/master/train.py"
click node_fake_data "https://github.com/sourabh-2610/truthlens/blob/master/Fake.csv"
click node_real_data "https://github.com/sourabh-2610/truthlens/blob/master/True.csv"
click node_classifier "https://github.com/sourabh-2610/truthlens/blob/master/model.pkl"
click node_vectorizer "https://github.com/sourabh-2610/truthlens/blob/master/vectorizer.pkl"

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_client,node_analysis_ui,node_history,node_media,node_auth,node_user toneBlue
class node_classifier,node_vectorizer toneAmber
class node_trainer,node_fake_data,node_real_data toneMint
class node_server toneTeal
```

## Components

### Web experience

- [Browser interface](https://github.com/sourabh-2610/truthlens/blob/master/static/JS/app.js): `static/JS/app.js`
- [Analysis results](https://github.com/sourabh-2610/truthlens/blob/master/static/JS/app.js): `static/JS/app.js`
- [Recent analyses](https://github.com/sourabh-2610/truthlens/blob/master/static/JS/app.js): `static/JS/app.js`
- [Image and camera input](https://github.com/sourabh-2610/truthlens/blob/master/static/JS/app.js): `static/JS/app.js`
- [Authentication forms](https://github.com/sourabh-2610/truthlens/blob/master/static/JS/app.js): `static/JS/app.js`

### Detection model

- [Classifier artifact](https://github.com/sourabh-2610/truthlens/blob/master/model.pkl): `model.pkl`
- [TF-IDF artifact](https://github.com/sourabh-2610/truthlens/blob/master/vectorizer.pkl): `vectorizer.pkl`

### Model training

- [Training pipeline](https://github.com/sourabh-2610/truthlens/blob/master/train.py): `train.py`
- [Fake news dataset](https://github.com/sourabh-2610/truthlens/blob/master/Fake.csv): `Fake.csv`
- [Real news dataset](https://github.com/sourabh-2610/truthlens/blob/master/True.csv): `True.csv`

### Other components

- **User**
- [Flask application](https://github.com/sourabh-2610/truthlens/blob/master/app.py): `app.py`

## Connections

- User → Browser interface: uses (evidence: `static/JS/app.js`)
- Browser interface → Image and camera input: selects or captures (evidence: `static/JS/app.js`)
- Browser interface → Authentication forms: opens forms (evidence: `static/JS/app.js`)
- Browser interface → Recent analyses: renders recents (evidence: `static/JS/app.js`)
- Browser interface → Analysis results: renders results (evidence: `static/JS/app.js`)
- Fake news dataset → Training pipeline: loads (evidence: `train.py`)
- Real news dataset → Training pipeline: loads (evidence: `train.py`)
- Training pipeline → Classifier artifact: writes (evidence: `train.py`)
- Training pipeline → TF-IDF artifact: writes (evidence: `train.py`)
