# sahana-652/voice-phishing-attack-detector architecture

> Architecture diagram of the GitHub repository sahana-652/voice-phishing-attack-detector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sahana-652/voice-phishing-attack-detector
- Repository: https://github.com/sahana-652/voice-phishing-attack-detector

## Overview

This is a voice-phishing detection application. A user selects an audio file in the React interface, submits it to the Flask analysis endpoint, and receives a classification, transcript, and keyword findings for display. The backend combines acoustic features and a loaded classifier with Whisper transcription and keyword checks. A separate training script builds and evaluates a model bundle. The excerpts establish the upload/API and training behaviors, but not every backend call; unsampled connections are omitted. The visible model paths differ between training and serving, so no artifact handoff is asserted.

Main entry points: [`app.py`](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py) (Analysis API), [`App.js`](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/App.js) (Detector interface), [`train_model.py`](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/train_model.py) (Training pipeline), [`index.js`](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/index.js) (React entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interface"]
  node_react_app["Detector interface<br/>[App.js]"]
  node_react_entry["React entry<br/>[index.js]"]
end

subgraph group_analysis["Audio analysis"]
  node_flask_api["Analysis API<br/>[app.py]"]
  node_upload["Temporary upload<br/>[app.py]"]
  node_features["Acoustic features<br/>[app.py]"]
  node_whisper["Speech transcription<br/>[app.py]"]
  node_keywords["Keyword detection<br/>[app.py]"]
  node_classifier["Classification<br/>[app.py]"]
  node_model_file["Model artifact"]
  node_result["Analysis result<br/>[app.py]"]
end

subgraph group_training["Model training"]
  node_training["Training pipeline<br/>[train_model.py]"]
  node_labels["Training labels<br/>[labels.csv]"]
  node_audio_sample["Audio sample<br/>[1.mp3]"]
end

node_user(("Audio user"))

node_user -->|"selects audio"| node_react_app
node_react_entry -->|"renders"| node_react_app
node_react_app -->|"posts upload"| node_flask_api
node_flask_api -->|"saves file"| node_upload
node_flask_api -->|"extracts features"| node_features
node_flask_api -->|"scales features"| node_classifier
node_flask_api -->|"loads model"| node_model_file
node_flask_api -->|"transcribes audio"| node_whisper
node_flask_api -->|"checks transcript"| node_keywords
node_flask_api -->|"returns analysis"| node_result
node_result -->|"displays findings"| node_react_app
node_training -.->|"loads audio"| node_audio_sample
node_training -.->|"reads labels"| node_labels

click node_react_app "https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/App.js"
click node_react_entry "https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/index.js"
click node_flask_api "https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py"
click node_upload "https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py"
click node_features "https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py"
click node_whisper "https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py"
click node_keywords "https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py"
click node_classifier "https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py"
click node_model_file "https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/vishing_model.joblib"
click node_result "https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py"
click node_training "https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/train_model.py"
click node_labels "https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/labels.csv"
click node_audio_sample "https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/1.mp3"

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_react_app,node_react_entry,node_user toneBlue
class node_flask_api,node_upload,node_features,node_whisper,node_keywords,node_classifier,node_model_file,node_result toneAmber
class node_training,node_labels,node_audio_sample toneMint
```

## Components

### User interface

- [Detector interface](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/App.js): `App.js`
- [React entry](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/index.js): `index.js`

### Audio analysis

- [Analysis API](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py): `app.py`
- [Temporary upload](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py): `app.py`
- [Acoustic features](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py): `app.py`
- [Speech transcription](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py): `app.py`
- [Keyword detection](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py): `app.py`
- [Classification](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py): `app.py`
- [Model artifact](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/vishing_model.joblib): `vishing_model.joblib`
- [Analysis result](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/app.py): `app.py`

### Model training

- [Training pipeline](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/train_model.py): `train_model.py`
- [Training labels](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/labels.csv): `labels.csv`
- [Audio sample](https://github.com/sahana-652/voice-phishing-attack-detector/blob/main/1.mp3): `1.mp3`

### Other components

- **Audio user**

## Connections

- Audio user → Detector interface: selects audio (evidence: `App.js`)
- React entry → Detector interface: renders (evidence: `index.js`)
- Detector interface → Analysis API: posts upload (evidence: `App.js`)
- Analysis API → Temporary upload: saves file (evidence: `app.py`)
- Analysis API → Acoustic features: extracts features (evidence: `app.py`)
- Analysis API → Classification: scales features (evidence: `app.py`)
- Analysis API → Model artifact: loads model (evidence: `app.py`)
- Analysis API → Speech transcription: transcribes audio (evidence: `app.py`)
- Analysis API → Keyword detection: checks transcript (evidence: `app.py`)
- Analysis API → Analysis result: returns analysis (evidence: `app.py`)
- Analysis result → Detector interface: displays findings (evidence: `App.js`)
- Training pipeline → Audio sample: loads audio
- Training pipeline → Training labels: reads labels
