# adeel-raza/profanity-filter architecture

> Architecture diagram of the GitHub repository adeel-raza/profanity-filter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adeel-raza/profanity-filter
- Repository: https://github.com/adeel-raza/profanity-filter

## Overview

This is a local video profanity-cleaning application with CLI and Gradio entry points. Users provide a video and optionally subtitles; detection identifies profanity intervals, timestamp merging prepares removal ranges, and video/subtitle processing produces cleaned files. The README also documents standalone subtitle generation and optional Intel OpenVINO acceleration. Some orchestration calls are only partially excerpted, so uncertain links are omitted or marked unverified.

Main entry points: [`audio_profanity_detector_fast.py`](https://github.com/adeel-raza/profanity-filter/blob/main/audio_profanity_detector_fast.py) (Whisper profanity detection), [`clean.py`](https://github.com/adeel-raza/profanity-filter/blob/main/clean.py) (CLI cleaner), [`gradio_app.py`](https://github.com/adeel-raza/profanity-filter/blob/main/gradio_app.py) (Gradio interface), [`subtitle_processor.py`](https://github.com/adeel-raza/profanity-filter/blob/main/subtitle_processor.py) (Subtitle processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_cli["CLI cleaner<br/>[clean.py]"]
  node_gradio["Gradio interface<br/>[gradio_app.py]"]
  node_launch["App launcher<br/>[app.py]"]
end

subgraph group_detection["Detection and configuration"]
  node_audio_fast["Whisper profanity detection"]
  node_audio_detector["Audio profanity detection"]
  node_hybrid["Hybrid detection"]
  node_words["Profanity word rules<br/>[profanity_words.py]"]
  node_subtitle_generation["Subtitle generation"]
end

subgraph group_processing["Media processing"]
  node_merger["Timestamp merger"]
  node_subtitle_processor["Subtitle processing"]
  node_cutter["Video cutting and muting<br/>[video_cutter.py]"]
  node_outputs["Cleaned video and subtitles"]
end

subgraph group_acceleration["Optional acceleration"]
  node_intel_probe["Intel GPU probe<br/>[intel_gpu_probe.py]"]
  node_openvino["OpenVINO Whisper backend"]
end

node_user(("Local user"))

node_user -->|"provides video"| node_cli
node_user -->|"uploads video"| node_gradio
node_launch -->|"creates interface"| node_gradio
node_cli -->|"uses detection"| node_audio_fast
node_cli -->|"selects mode"| node_hybrid
node_cli -->|"detects from subtitles"| node_subtitle_processor
node_cli -.->|"merges intervals"| node_merger
node_cli -.->|"processes video"| node_cutter
node_gradio -->|"transcribes audio"| node_audio_fast
node_gradio -->|"merges intervals"| node_merger
node_gradio -->|"cuts segments"| node_cutter
node_gradio -->|"processes subtitles"| node_subtitle_processor
node_audio_fast -->|"checks words"| node_words
node_audio_detector -->|"uses word list"| node_words
node_subtitle_processor -->|"filters text"| node_words
node_hybrid -->|"refines intervals"| node_audio_fast
node_hybrid -->|"finds candidates"| node_subtitle_processor
node_hybrid -->|"merges intervals"| node_merger
node_subtitle_generation -->|"uses transcription"| node_audio_fast
node_audio_fast -->|"checks hardware"| node_intel_probe
node_audio_fast -->|"tries backend"| node_openvino
node_cutter -.->|"writes video"| node_outputs
node_subtitle_processor -.->|"writes subtitles"| node_outputs

click node_cli "https://github.com/adeel-raza/profanity-filter/blob/main/clean.py"
click node_gradio "https://github.com/adeel-raza/profanity-filter/blob/main/gradio_app.py"
click node_launch "https://github.com/adeel-raza/profanity-filter/blob/main/app.py"
click node_audio_fast "https://github.com/adeel-raza/profanity-filter/blob/main/audio_profanity_detector_fast.py"
click node_audio_detector "https://github.com/adeel-raza/profanity-filter/blob/main/audio_profanity_detector.py"
click node_hybrid "https://github.com/adeel-raza/profanity-filter/blob/main/hybrid_profanity_detector.py"
click node_words "https://github.com/adeel-raza/profanity-filter/blob/main/profanity_words.py"
click node_subtitle_generation "https://github.com/adeel-raza/profanity-filter/blob/main/generate_subtitles.py"
click node_intel_probe "https://github.com/adeel-raza/profanity-filter/blob/main/intel_gpu_probe.py"
click node_openvino "https://github.com/adeel-raza/profanity-filter/blob/main/openvino_whisper_backend.py"
click node_merger "https://github.com/adeel-raza/profanity-filter/blob/main/timestamp_merger.py"
click node_subtitle_processor "https://github.com/adeel-raza/profanity-filter/blob/main/subtitle_processor.py"
click node_cutter "https://github.com/adeel-raza/profanity-filter/blob/main/video_cutter.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_cli,node_gradio,node_launch,node_user toneBlue
class node_audio_fast,node_audio_detector,node_hybrid,node_words,node_subtitle_generation toneAmber
class node_merger,node_subtitle_processor,node_cutter,node_outputs toneMint
class node_intel_probe,node_openvino toneRose
```

## Components

### User entry points

- [CLI cleaner](https://github.com/adeel-raza/profanity-filter/blob/main/clean.py): `clean.py`
- [Gradio interface](https://github.com/adeel-raza/profanity-filter/blob/main/gradio_app.py): `gradio_app.py`
- [App launcher](https://github.com/adeel-raza/profanity-filter/blob/main/app.py): `app.py`

### Detection and configuration

- [Whisper profanity detection](https://github.com/adeel-raza/profanity-filter/blob/main/audio_profanity_detector_fast.py): `audio_profanity_detector_fast.py`
- [Audio profanity detection](https://github.com/adeel-raza/profanity-filter/blob/main/audio_profanity_detector.py): `audio_profanity_detector.py`
- [Hybrid detection](https://github.com/adeel-raza/profanity-filter/blob/main/hybrid_profanity_detector.py): `hybrid_profanity_detector.py`
- [Profanity word rules](https://github.com/adeel-raza/profanity-filter/blob/main/profanity_words.py): `profanity_words.py`
- [Subtitle generation](https://github.com/adeel-raza/profanity-filter/blob/main/generate_subtitles.py): `generate_subtitles.py`

### Media processing

- [Timestamp merger](https://github.com/adeel-raza/profanity-filter/blob/main/timestamp_merger.py): `timestamp_merger.py`
- [Subtitle processing](https://github.com/adeel-raza/profanity-filter/blob/main/subtitle_processor.py): `subtitle_processor.py`
- [Video cutting and muting](https://github.com/adeel-raza/profanity-filter/blob/main/video_cutter.py): `video_cutter.py`
- **Cleaned video and subtitles**

### Optional acceleration

- [Intel GPU probe](https://github.com/adeel-raza/profanity-filter/blob/main/intel_gpu_probe.py): `intel_gpu_probe.py`
- [OpenVINO Whisper backend](https://github.com/adeel-raza/profanity-filter/blob/main/openvino_whisper_backend.py): `openvino_whisper_backend.py`

### Other components

- **Local user**

## Connections

- Local user → CLI cleaner: provides video (evidence: `README.md`)
- Local user → Gradio interface: uploads video (evidence: `README.md`)
- App launcher → Gradio interface: creates interface (evidence: `app.py`)
- CLI cleaner → Whisper profanity detection: uses detection (evidence: `clean.py`)
- CLI cleaner → Hybrid detection: selects mode (evidence: `clean.py`)
- CLI cleaner → Subtitle processing: detects from subtitles (evidence: `clean.py`)
- CLI cleaner → Timestamp merger: merges intervals (evidence: `clean.py`)
- CLI cleaner → Video cutting and muting: processes video (evidence: `clean.py`)
- Gradio interface → Whisper profanity detection: transcribes audio (evidence: `gradio_app.py`)
- Gradio interface → Timestamp merger: merges intervals (evidence: `gradio_app.py`)
- Gradio interface → Video cutting and muting: cuts segments (evidence: `gradio_app.py`)
- Gradio interface → Subtitle processing: processes subtitles (evidence: `gradio_app.py`)
- Whisper profanity detection → Profanity word rules: checks words (evidence: `audio_profanity_detector_fast.py`)
- Audio profanity detection → Profanity word rules: uses word list (evidence: `audio_profanity_detector.py`)
- Subtitle processing → Profanity word rules: filters text (evidence: `subtitle_processor.py`)
- Hybrid detection → Whisper profanity detection: refines intervals (evidence: `hybrid_profanity_detector.py`)
- Hybrid detection → Subtitle processing: finds candidates (evidence: `hybrid_profanity_detector.py`)
- Hybrid detection → Timestamp merger: merges intervals (evidence: `hybrid_profanity_detector.py`)
- Subtitle generation → Whisper profanity detection: uses transcription (evidence: `generate_subtitles.py`)
- Whisper profanity detection → Intel GPU probe: checks hardware (evidence: `audio_profanity_detector_fast.py`)
- Whisper profanity detection → OpenVINO Whisper backend: tries backend (evidence: `audio_profanity_detector_fast.py`)
- Video cutting and muting → Cleaned video and subtitles: writes video
- Subtitle processing → Cleaned video and subtitles: writes subtitles
