# jhj0517/whisper-webui architecture

> Architecture diagram of the GitHub repository jhj0517/whisper-webui, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jhj0517/whisper-webui
- Repository: https://github.com/jhj0517/whisper-webui

## Overview

##### Main Components

a) Frontend Layer:
- Gradio Web Interface (main entry point through app.py)
- UI Components (modules/ui)

b) Core Processing Modules:
- Whisper Module (modules/whisper) with multiple implementations
- Translation Module (modules/translation)
- Voice Activity Detection Module (modules/vad)
- Diarization Module (modules/diarize)
- UVR Module for BGM separation (modules/uvr)

c) Backend Services:
- FastAPI Backend (backend/)
- Nginx Server (backend/nginx)
- Database Layer (backend/db)
- Cache System (backend/cache)

d) External Services:
- DeepL API Integration
- HuggingFace Models
- YouTube Integration

**[Client Layer]**
- ↓↑
**[Web Interface Layer]**
- ↓↑
**[Processing Pipeline Layer]**
- ↓↑
**[Storage Layer]**

##### Key Relationships to Highlight

a) Pipeline Flow:
##### Parallel processing capabilities for different implementations

b) Data Flow:
- Audio Input → VAD/BGM Separation → Whisper Processing → Translation → Subtitle Generation
- Cache and Database interactions

##### Implementation Details

- The main architecture overview
- The transcription pipeline (as shown in the README)
- The backend API architecture
- The storage and caching system

##### Critical Flows to Emphasize

- Audio Processing Pipeline
- Translation Services Integration
- API Communication Patterns
- Cache/Storage Interactions

##### Technical Stack Indicators

- Python
- FastAPI
- Gradio
- PyTorch
- CUDA
- FFmpeg
- Nginx

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph WebInterface
        GradioUI["Gradio Web Interface"]:::ui
        UIComponents["UI Components"]:::ui
    end

    subgraph InputSources
        Files["File Upload"]:::input
        YT["YouTube"]:::input
        Mic["Microphone"]:::input
    end

    subgraph ProcessingPipeline
        PreProcess["Pre-Processing"]:::process
        
        subgraph AudioProcessing
            VAD["Voice Activity Detection"]:::process
            BGM["UVR (BGM Separation)"]:::process
            Diarize["Speaker Diarization"]:::process
        end
        
        subgraph TranscriptionEngine
            Whisper["Whisper Module"]:::core
            FastWhisper["Faster Whisper"]:::core
            InsanelyFast["Insanely Fast Whisper"]:::core
        end
        
        subgraph TranslationService
            WhisperTrans["Whisper Translation"]:::core
            NLLB["NLLB Translation"]:::core
            DeepL["DeepL API"]:::external
        end
    end

    subgraph Backend
        FastAPI["FastAPI Server"]:::backend
        Nginx["Nginx Server"]:::backend
        Routers["API Routers"]:::backend
    end

    subgraph Storage
        DB["Database"]:::storage
        Cache["Cache System"]:::storage
        Models["Model Storage"]:::storage
        Outputs["Output Storage"]:::storage
    end

    subgraph ExternalServices
        HF["HuggingFace Models"]:::external
    end

    %% Connections
    Browser --> GradioUI
    GradioUI --> UIComponents
    
    Files & YT & Mic --> PreProcess
    
    PreProcess --> AudioProcessing
    VAD & BGM & Diarize --> TranscriptionEngine
    
    TranscriptionEngine --> TranslationService
    TranslationService --> FastAPI
    
    FastAPI --> Nginx
    FastAPI --> Routers
    
    Routers --> DB
    Routers --> Cache
    
    TranscriptionEngine --> HF
    TranslationService --> HF

    %% Click Events
    click GradioUI "https://github.com/jhj0517/Whisper-WebUI/blob/master/app.py"
    click UIComponents "https://github.com/jhj0517/Whisper-WebUI/tree/master/modules/ui/"
    click Whisper "https://github.com/jhj0517/Whisper-WebUI/tree/master/modules/whisper/"
    click WhisperTrans "https://github.com/jhj0517/Whisper-WebUI/tree/master/modules/translation/"
    click VAD "https://github.com/jhj0517/Whisper-WebUI/tree/master/modules/vad/"
    click Diarize "https://github.com/jhj0517/Whisper-WebUI/tree/master/modules/diarize/"
    click BGM "https://github.com/jhj0517/Whisper-WebUI/tree/master/modules/uvr/"
    click FastAPI "https://github.com/jhj0517/Whisper-WebUI/blob/master/backend/main.py"
    click Nginx "https://github.com/jhj0517/Whisper-WebUI/tree/master/backend/nginx/"
    click DB "https://github.com/jhj0517/Whisper-WebUI/tree/master/backend/db/"
    click Cache "https://github.com/jhj0517/Whisper-WebUI/tree/master/backend/cache/"
    click DeepL "https://github.com/jhj0517/Whisper-WebUI/blob/master/modules/translation/deepl_api.py"
    click YT "https://github.com/jhj0517/Whisper-WebUI/blob/master/modules/utils/youtube_manager.py"
    click Routers "https://github.com/jhj0517/Whisper-WebUI/tree/master/backend/routers/"
    click Models "https://github.com/jhj0517/Whisper-WebUI/tree/master/models/"
    click Outputs "https://github.com/jhj0517/Whisper-WebUI/tree/master/outputs/"

    %% Styles
    classDef ui fill:#9370DB
    classDef input fill:#4169E1
    classDef process fill:#20B2AA
    classDef core fill:#4682B4
    classDef backend fill:#778899
    classDef storage fill:#DEB887
    classDef external fill:#90EE90

    %% Legend
    subgraph Legend
        UI[UI Components]:::ui
        Input[Input Sources]:::input
        Process[Processing]:::process
        Core[Core Components]:::core
        Back[Backend Services]:::backend
        Store[Storage]:::storage
        Ext[External Services]:::external
    end
```
