# dishagupta275/regional_deepfake_voice_detector architecture

> Architecture diagram of the GitHub repository dishagupta275/regional_deepfake_voice_detector, 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/dishagupta275/regional_deepfake_voice_detector
- Repository: https://github.com/dishagupta275/regional_deepfake_voice_detector

## Overview

This prototype builds and serves a four-class speech-manipulation detector. The main user workflow uploads audio, converts non-WAV files, extracts acoustic features, applies trained artifacts, and displays a label with confidence. Separate preparation and training paths create AI-generated or simulated voice-changer samples, extract dataset features, and fit the Random Forest model. The README also specifies genuine-speech and human-mimicry data. Source excerpts show the app and pipeline calls; the broader dataset guidance comes from the README.

Main entry points: [`app.py`](https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/app.py) (Streamlit Demo), [`extract_features.py`](https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/extract_features.py) (Acoustic Features), [`generate_ai_speech.py`](https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/generate_ai_speech.py) (AI Speech Samples), [`train_model.py`](https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/train_model.py) (Random Forest Training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_demo["Interactive Detection"]
  node_app["Streamlit Demo<br/>[app.py]"]
  node_result["Class And Confidence<br/>[app.py]"]
end

subgraph group_analysis["Audio Analysis"]
  node_converter["WAV Converter<br/>[convert_to_wav.py]"]
  node_features["Acoustic Features"]
  node_corpus[("Labeled Audio Data")]
end

subgraph group_training["Model Training"]
  node_featuredata["Feature Dataset"]
  node_trainer["Random Forest Training<br/>[train_model.py]"]
  node_artifacts[("Model Artifacts<br/>[classifier.joblib]")]
end

subgraph group_preparation["Sample Preparation"]
  node_realdata[("Real Speech Samples")]
  node_vcgenerator["Voice-Changer Samples"]
  node_aigenerator["AI Speech Samples"]
end

node_user(("Audio Uploader"))
node_tts["Indic Parler-TTS"]

node_user -->|"uploads audio"| node_app
node_app -->|"converts formats"| node_converter
node_app -->|"extracts features"| node_features
node_features -->|"returns features"| node_app
node_app -->|"loads artifacts"| node_artifacts
node_app -->|"predicts and displays"| node_result
node_corpus -->|"provides labeled clips"| node_features
node_features -->|"writes feature rows"| node_featuredata
node_featuredata -->|"trains from"| node_trainer
node_trainer -->|"saves model files"| node_artifacts
node_realdata -->|"provides source clips"| node_vcgenerator
node_vcgenerator -->|"creates altered samples"| node_corpus
node_aigenerator -->|"generates with"| node_tts
node_aigenerator -->|"writes generated clips"| node_corpus

click node_app "https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/app.py"
click node_result "https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/app.py"
click node_converter "https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/convert_to_wav.py"
click node_features "https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/extract_features.py"
click node_featuredata "https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/extract_features.py"
click node_trainer "https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/train_model.py"
click node_artifacts "https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/models/classifier.joblib"
click node_vcgenerator "https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/generate_voice_changer_samples.py"
click node_aigenerator "https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/generate_ai_speech.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_app,node_result toneBlue
class node_converter,node_features,node_corpus toneAmber
class node_featuredata,node_trainer,node_artifacts toneMint
class node_realdata,node_vcgenerator,node_aigenerator toneRose
class node_user,node_tts toneIndigo
```

## Components

### Interactive Detection

- [Streamlit Demo](https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/app.py): `app.py`
- [Class And Confidence](https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/app.py): `app.py`

### Audio Analysis

- [WAV Converter](https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/convert_to_wav.py): `convert_to_wav.py`
- [Acoustic Features](https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/extract_features.py): `extract_features.py`
- **Labeled Audio Data**

### Model Training

- [Feature Dataset](https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/extract_features.py): `extract_features.py`
- [Random Forest Training](https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/train_model.py): `train_model.py`
- [Model Artifacts](https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/models/classifier.joblib): `models/classifier.joblib`

### Sample Preparation

- **Real Speech Samples**
- [Voice-Changer Samples](https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/generate_voice_changer_samples.py): `generate_voice_changer_samples.py`
- [AI Speech Samples](https://github.com/dishagupta275/regional_deepfake_voice_detector/blob/main/generate_ai_speech.py): `generate_ai_speech.py`

### Other components

- **Audio Uploader**
- **Indic Parler-TTS**

## Connections

- Audio Uploader → Streamlit Demo: uploads audio (evidence: `app.py`)
- Streamlit Demo → WAV Converter: converts formats (evidence: `app.py`)
- Streamlit Demo → Acoustic Features: extracts features (evidence: `app.py`)
- Acoustic Features → Streamlit Demo: returns features (evidence: `app.py`)
- Streamlit Demo → Model Artifacts: loads artifacts (evidence: `app.py`)
- Streamlit Demo → Class And Confidence: predicts and displays (evidence: `app.py`)
- Labeled Audio Data → Acoustic Features: provides labeled clips (evidence: `README.md`)
- Acoustic Features → Feature Dataset: writes feature rows (evidence: `extract_features.py`)
- Feature Dataset → Random Forest Training: trains from (evidence: `train_model.py`)
- Random Forest Training → Model Artifacts: saves model files (evidence: `train_model.py`)
- Real Speech Samples → Voice-Changer Samples: provides source clips (evidence: `generate_voice_changer_samples.py`)
- Voice-Changer Samples → Labeled Audio Data: creates altered samples (evidence: `generate_voice_changer_samples.py`)
- AI Speech Samples → Indic Parler-TTS: generates with (evidence: `generate_ai_speech.py`)
- AI Speech Samples → Labeled Audio Data: writes generated clips (evidence: `generate_ai_speech.py`)
