# tawassulgoharellahi/deepfense-audio-detector architecture

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

- Interactive diagram: https://gitdiagram.com/tawassulgoharellahi/deepfense-audio-detector
- Repository: https://github.com/tawassulgoharellahi/deepfense-audio-detector

## Overview

DeepFense Audio Detector is a web service for detecting spoofed or AI-generated speech. Clients authenticate through Google OAuth for the dashboard; the REST endpoint also supports session-or-IP identity. The request path checks and consumes daily quota, preprocesses audio, runs chunked WavLM/Nes2Net inference, and returns segment and overall results through JSON or the Gradio dashboard. The README documents the dashboard, API, access controls, preprocessing, and model behavior; the excerpts show key calls in app.py and detector.py, but utils.py was not sampled.

Main entry points: [`app.py`](https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/app.py) (Gradio dashboard), [`detector.py`](https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/detector.py) (Chunked detector), [`quota_manager.py`](https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/quota_manager.py) (Daily quota manager), [`utils.py`](https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/utils.py) (Audio preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and interfaces"]
  node_app_auth["Session and OAuth<br/>[app.py]"]
  node_dashboard["Gradio dashboard<br/>[app.py]"]
  node_api["Detection API<br/>[app.py]"]
end

subgraph group_quota["Quota management"]
  node_quota["Daily quota manager<br/>[quota_manager.py]"]
  node_quota_db[("SQLite quota store<br/>[quota_manager.py]")]
end

subgraph group_audio["Audio analysis"]
  node_preprocess["Audio preprocessing<br/>[utils.py]"]
  node_results["Predictions and report<br/>[app.py]"]
end

subgraph group_inference["Inference"]
  node_detector["Chunked detector<br/>[detector.py]"]
  node_model_config["Model configuration<br/>[config.yaml]"]
end

node_browser(("Browser user"))
node_api_client(("API client"))
node_google["Google OAuth"]
node_deepfense_model["DeepFense model runtime"]

node_browser -->|"requests access"| node_app_auth
node_api_client -->|"submits audio"| node_api
node_app_auth -->|"redirects for login"| node_google
node_app_auth -->|"protects access"| node_dashboard
node_api -->|"consumes quota"| node_quota
node_dashboard -->|"checks and consumes"| node_quota
node_quota -->|"reads and writes"| node_quota_db
node_api -->|"preprocesses audio"| node_preprocess
node_dashboard -->|"preprocesses audio"| node_preprocess
node_api -.->|"runs inference"| node_detector
node_dashboard -->|"runs inference"| node_detector
node_detector -->|"loads configuration"| node_model_config
node_detector -->|"calls model"| node_deepfense_model
node_api -.->|"returns JSON"| node_results
node_dashboard -->|"renders report"| node_results

click node_app_auth "https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/app.py"
click node_dashboard "https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/app.py"
click node_api "https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/app.py"
click node_quota "https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/quota_manager.py"
click node_quota_db "https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/quota_manager.py"
click node_preprocess "https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/utils.py"
click node_detector "https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/detector.py"
click node_model_config "https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/models/ASV19_WavLM_Nes2Net_NoAug_Seed42/config.yaml"
click node_results "https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/app.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_auth,node_dashboard,node_api,node_browser,node_api_client toneBlue
class node_quota,node_quota_db toneAmber
class node_preprocess,node_results toneMint
class node_detector,node_model_config toneRose
class node_google,node_deepfense_model toneIndigo
```

## Components

### Access and interfaces

- [Session and OAuth](https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/app.py): `app.py`
- [Gradio dashboard](https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/app.py): `app.py`
- [Detection API](https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/app.py): `app.py`

### Quota management

- [Daily quota manager](https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/quota_manager.py): `quota_manager.py`
- [SQLite quota store](https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/quota_manager.py): `quota_manager.py`

### Audio analysis

- [Audio preprocessing](https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/utils.py): `utils.py`
- [Predictions and report](https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/app.py): `app.py`

### Inference

- [Chunked detector](https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/detector.py): `detector.py`
- [Model configuration](https://github.com/tawassulgoharellahi/deepfense-audio-detector/blob/main/models/ASV19_WavLM_Nes2Net_NoAug_Seed42/config.yaml): `models/ASV19_WavLM_Nes2Net_NoAug_Seed42/config.yaml`

### Other components

- **Browser user**
- **API client**
- **Google OAuth**
- **DeepFense model runtime**

## Connections

- Browser user → Session and OAuth: requests access (evidence: `README.md`)
- API client → Detection API: submits audio (evidence: `README.md`)
- Session and OAuth → Google OAuth: redirects for login (evidence: `app.py`)
- Session and OAuth → Gradio dashboard: protects access (evidence: `README.md`)
- Detection API → Daily quota manager: consumes quota (evidence: `app.py`)
- Gradio dashboard → Daily quota manager: checks and consumes (evidence: `app.py`)
- Daily quota manager → SQLite quota store: reads and writes (evidence: `quota_manager.py`)
- Detection API → Audio preprocessing: preprocesses audio (evidence: `app.py`)
- Gradio dashboard → Audio preprocessing: preprocesses audio (evidence: `app.py`)
- Detection API → Chunked detector: runs inference (evidence: `app.py`)
- Gradio dashboard → Chunked detector: runs inference (evidence: `app.py`)
- Chunked detector → Model configuration: loads configuration (evidence: `detector.py`)
- Chunked detector → DeepFense model runtime: calls model (evidence: `detector.py`)
- Detection API → Predictions and report: returns JSON (evidence: `app.py`)
- Gradio dashboard → Predictions and report: renders report (evidence: `app.py`)
