# deepbeepmeep/wangp architecture

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

## Overview

WanGP is a local generative-media application spanning video, image, audio/TTS, and 3D. The principal workflow is a user submitting a generation request through the web interface or API, selecting a model, and receiving an output that can be browsed and reused. Its runtime also includes job queuing, input preparation, postprocessing, workspace storage, and low-VRAM model execution. The README documents these capabilities; sampled source excerpts show selected inference and memory-management behavior, but not the overall application dispatch path, so that connection is marked unverified.

Main entry points: [`shared/gradio`](https://github.com/deepbeepmeep/wangp/tree/main/shared/gradio) (Generation Queue), [`models/wan`](https://github.com/deepbeepmeep/wangp/tree/main/models/wan) (Video Generation), [`models`](https://github.com/deepbeepmeep/wangp/tree/main/models) (Image Generation), [`models/TTS`](https://github.com/deepbeepmeep/wangp/tree/main/models/TTS) (Audio and TTS)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_web["Web Interface"]
  node_api["WanGP API<br/>[fastapi_routes.py]"]
  node_headless["Headless Mode<br/>[wgp.py]"]
  node_queue["Generation Queue"]
  node_workspace[("Workspace Storage")]
end

subgraph group_media["Generation Models"]
  node_video["Video Generation"]
  node_image["Image Generation"]
  node_audio["Audio and TTS"]
  node_three_d["3D Generation"]
end

subgraph group_tools["Media Tools"]
  node_input_tools["Input Preparation"]
  node_prompt["Prompt Enhancement"]
  node_postprocess["Output Processing"]
  node_galleries["Media Galleries"]
end

subgraph group_runtime["Runtime Services"]
  node_mmgp["VRAM Offloading<br/>[offload.py]"]
  node_model_downloads["Model Downloads<br/>[files_locator.py]"]
end

subgraph group_agent["Automation"]
  node_deepy["Deepy Agent<br/>[controller.py]"]
  node_mcp["MCP Server<br/>[server.py]"]
end

node_user(("User"))

node_user -->|"submits requests"| node_web
node_user -->|"sends requests"| node_api
node_user -->|"launches batches"| node_headless
node_web -->|"queues jobs"| node_queue
node_api -.->|"queues jobs"| node_queue
node_headless -.->|"requests generation"| node_video
node_queue -.->|"dispatches jobs"| node_video
node_queue -.->|"dispatches jobs"| node_image
node_queue -.->|"dispatches jobs"| node_audio
node_queue -.->|"dispatches jobs"| node_three_d
node_video -.->|"uses offloading"| node_mmgp
node_image -.->|"uses offloading"| node_mmgp
node_audio -->|"uses offloading"| node_mmgp
node_user -->|"prepares inputs"| node_input_tools
node_video -.->|"enhances prompts"| node_prompt
node_image -.->|"processes outputs"| node_postprocess
node_video -->|"processes outputs"| node_postprocess
node_audio -->|"processes outputs"| node_postprocess
node_web -->|"manages media"| node_workspace
node_workspace -->|"provides generations"| node_galleries
node_user -->|"assigns tasks"| node_deepy
node_deepy -->|"offers agent tools"| node_mcp
node_video -->|"selects model files"| node_model_downloads
node_image -->|"selects model files"| node_model_downloads
node_audio -->|"selects model files"| node_model_downloads

click node_web "https://github.com/deepbeepmeep/wangp/tree/main/shared/gradio"
click node_api "https://github.com/deepbeepmeep/wangp/blob/main/shared/utils/fastapi_routes.py"
click node_headless "https://github.com/deepbeepmeep/wangp/blob/main/wgp.py"
click node_queue "https://github.com/deepbeepmeep/wangp/tree/main/shared/gradio"
click node_workspace "https://github.com/deepbeepmeep/wangp/blob/main/shared/utils/workspace_storage.py"
click node_video "https://github.com/deepbeepmeep/wangp/tree/main/models/wan"
click node_image "https://github.com/deepbeepmeep/wangp/tree/main/models"
click node_audio "https://github.com/deepbeepmeep/wangp/tree/main/models/TTS"
click node_three_d "https://github.com/deepbeepmeep/wangp/tree/main/models/hunyuan3d"
click node_input_tools "https://github.com/deepbeepmeep/wangp/tree/main/preprocessing"
click node_prompt "https://github.com/deepbeepmeep/wangp/blob/main/models/TTS/prompt_enhancers.py"
click node_postprocess "https://github.com/deepbeepmeep/wangp/tree/main/postprocessing"
click node_galleries "https://github.com/deepbeepmeep/wangp/tree/main/shared/utils"
click node_mmgp "https://github.com/deepbeepmeep/wangp/blob/main/mmgp/offload.py"
click node_model_downloads "https://github.com/deepbeepmeep/wangp/blob/main/shared/utils/files_locator.py"
click node_deepy "https://github.com/deepbeepmeep/wangp/blob/main/shared/deepy/controller.py"
click node_mcp "https://github.com/deepbeepmeep/wangp/blob/main/shared/mcp/server.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_web,node_api,node_headless,node_queue,node_workspace,node_user toneBlue
class node_video,node_image,node_audio,node_three_d toneAmber
class node_input_tools,node_prompt,node_postprocess,node_galleries toneMint
class node_mmgp,node_model_downloads toneRose
class node_deepy,node_mcp toneIndigo
```

## Components

### Application

- [Web Interface](https://github.com/deepbeepmeep/wangp/tree/main/shared/gradio): `shared/gradio`
- [WanGP API](https://github.com/deepbeepmeep/wangp/blob/main/shared/utils/fastapi_routes.py): `shared/utils/fastapi_routes.py`
- [Headless Mode](https://github.com/deepbeepmeep/wangp/blob/main/wgp.py): `wgp.py`
- [Generation Queue](https://github.com/deepbeepmeep/wangp/tree/main/shared/gradio): `shared/gradio`
- [Workspace Storage](https://github.com/deepbeepmeep/wangp/blob/main/shared/utils/workspace_storage.py): `shared/utils/workspace_storage.py`

### Generation Models

- [Video Generation](https://github.com/deepbeepmeep/wangp/tree/main/models/wan): `models/wan`
- [Image Generation](https://github.com/deepbeepmeep/wangp/tree/main/models): `models`
- [Audio and TTS](https://github.com/deepbeepmeep/wangp/tree/main/models/TTS): `models/TTS`
- [3D Generation](https://github.com/deepbeepmeep/wangp/tree/main/models/hunyuan3d): `models/hunyuan3d`

### Media Tools

- [Input Preparation](https://github.com/deepbeepmeep/wangp/tree/main/preprocessing): `preprocessing`
- [Prompt Enhancement](https://github.com/deepbeepmeep/wangp/blob/main/models/TTS/prompt_enhancers.py): `models/TTS/prompt_enhancers.py`
- [Output Processing](https://github.com/deepbeepmeep/wangp/tree/main/postprocessing): `postprocessing`
- [Media Galleries](https://github.com/deepbeepmeep/wangp/tree/main/shared/utils): `shared/utils`

### Runtime Services

- [VRAM Offloading](https://github.com/deepbeepmeep/wangp/blob/main/mmgp/offload.py): `mmgp/offload.py`
- [Model Downloads](https://github.com/deepbeepmeep/wangp/blob/main/shared/utils/files_locator.py): `shared/utils/files_locator.py`

### Automation

- [Deepy Agent](https://github.com/deepbeepmeep/wangp/blob/main/shared/deepy/controller.py): `shared/deepy/controller.py`
- [MCP Server](https://github.com/deepbeepmeep/wangp/blob/main/shared/mcp/server.py): `shared/mcp/server.py`

### Other components

- **User**

## Connections

- User → Web Interface: submits requests
- User → WanGP API: sends requests
- User → Headless Mode: launches batches
- Web Interface → Generation Queue: queues jobs
- WanGP API → Generation Queue: queues jobs
- Headless Mode → Video Generation: requests generation
- Generation Queue → Video Generation: dispatches jobs
- Generation Queue → Image Generation: dispatches jobs
- Generation Queue → Audio and TTS: dispatches jobs
- Generation Queue → 3D Generation: dispatches jobs
- Video Generation → VRAM Offloading: uses offloading (evidence: `models/wan/ovi_fusion_engine.py`)
- Image Generation → VRAM Offloading: uses offloading (evidence: `models/minimax_h3/pipeline.py`)
- Audio and TTS → VRAM Offloading: uses offloading (evidence: `models/TTS/ace_step15/pipeline_ace_step15.py`)
- User → Input Preparation: prepares inputs
- Video Generation → Prompt Enhancement: enhances prompts
- Image Generation → Output Processing: processes outputs
- Video Generation → Output Processing: processes outputs
- Audio and TTS → Output Processing: processes outputs
- Web Interface → Workspace Storage: manages media
- Workspace Storage → Media Galleries: provides generations (evidence: `shared/utils/workspace_storage.py`)
- User → Deepy Agent: assigns tasks
- Deepy Agent → MCP Server: offers agent tools
- Video Generation → Model Downloads: selects model files (evidence: `models/wan/ovi_fusion_engine.py`)
- Image Generation → Model Downloads: selects model files (evidence: `models/ming_image/ming_pipeline.py`)
- Audio and TTS → Model Downloads: selects model files (evidence: `models/TTS/index_tts2/pipeline.py`)
