# d-ogi/watermarkremover-ai architecture

> Architecture diagram of the GitHub repository d-ogi/watermarkremover-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/d-ogi/watermarkremover-ai
- Repository: https://github.com/d-ogi/watermarkremover-ai

## Overview

WatermarkRemover-AI detects watermark regions with Florence-2, then removes them through LaMA inpainting; users can run this workflow from the desktop GUI or CLI, with image, video, batch, preview, and mask options. The GUI delegates processing to the CLI and prepares models in a worker. The graph also shows the separate model-cache and LaMA execution layers. UI-to-bridge wiring and some unsampled video details are not fully visible in the excerpts, so uncertain links are omitted or marked unverified.

Main entry points: [`remwm.py`](https://github.com/d-ogi/watermarkremover-ai/blob/main/remwm.py) (CLI workflow), [`remwmgui.py`](https://github.com/d-ogi/watermarkremover-ai/blob/main/remwmgui.py) (Desktop GUI bridge), [`lama_inpaint/runtime.py`](https://github.com/d-ogi/watermarkremover-ai/blob/main/lama_inpaint/runtime.py) (LaMA inference), [`desktop_models.py`](https://github.com/d-ogi/watermarkremover-ai/blob/main/desktop_models.py) (Model preparation worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User interfaces"]
  node_desktop_entry["Desktop entry<br/>[desktop_main.py]"]
  node_desktop_gui["Desktop GUI bridge<br/>[remwmgui.py]"]
  node_web_ui["Web UI<br/>[index.html]"]
end

subgraph group_workflow["Detection and removal"]
  node_cli["CLI workflow<br/>[remwm.py]"]
  node_detection["Watermark detection<br/>[remwm.py]"]
  node_masking["Mask construction<br/>[remwm.py]"]
  node_media_processing["Image and video processing<br/>[remwm.py]"]
end

subgraph group_models["Model preparation"]
  node_florence_assets["Florence assets<br/>[model_assets.py]"]
  node_florence_service["Hugging Face model source"]
  node_lama_runtime["LaMA inference<br/>[runtime.py]"]
  node_lama_processing["Inpaint crop and composite<br/>[processing.py]"]
  node_lama_store[("Verified LaMA cache<br/>[model_store.py]")]
  node_lama_service["LaMA model source"]
end

subgraph group_runtime["Desktop runtime"]
  node_model_worker["Model preparation worker<br/>[desktop_models.py]"]
  node_runtime_config["Runtime paths and workers<br/>[desktop_runtime.py]"]
end

node_user(("User"))

node_user -->|"launches"| node_desktop_entry
node_user -->|"invokes"| node_cli
node_desktop_entry -->|"starts"| node_desktop_gui
node_web_ui -.->|"calls bridge"| node_desktop_gui
node_desktop_gui -->|"prepares models"| node_model_worker
node_model_worker -->|"uses worker settings"| node_runtime_config
node_model_worker -->|"runs preparation"| node_florence_assets
node_florence_assets -->|"downloads"| node_florence_service
node_desktop_gui -->|"starts processing"| node_cli
node_cli -->|"loads detection assets"| node_florence_assets
node_cli -->|"runs detection"| node_detection
node_detection -->|"builds masks"| node_masking
node_cli -->|"processes media"| node_media_processing
node_media_processing -->|"inpaints regions"| node_lama_runtime
node_lama_runtime -->|"verifies and loads"| node_lama_store
node_lama_runtime -->|"delegates compositing"| node_lama_processing
node_lama_store -->|"downloads weights"| node_lama_service

click node_desktop_entry "https://github.com/d-ogi/watermarkremover-ai/blob/main/desktop_main.py"
click node_desktop_gui "https://github.com/d-ogi/watermarkremover-ai/blob/main/remwmgui.py"
click node_web_ui "https://github.com/d-ogi/watermarkremover-ai/blob/main/ui/index.html"
click node_cli "https://github.com/d-ogi/watermarkremover-ai/blob/main/remwm.py"
click node_detection "https://github.com/d-ogi/watermarkremover-ai/blob/main/remwm.py"
click node_masking "https://github.com/d-ogi/watermarkremover-ai/blob/main/remwm.py"
click node_media_processing "https://github.com/d-ogi/watermarkremover-ai/blob/main/remwm.py"
click node_florence_assets "https://github.com/d-ogi/watermarkremover-ai/blob/main/model_assets.py"
click node_model_worker "https://github.com/d-ogi/watermarkremover-ai/blob/main/desktop_models.py"
click node_runtime_config "https://github.com/d-ogi/watermarkremover-ai/blob/main/desktop_runtime.py"
click node_lama_runtime "https://github.com/d-ogi/watermarkremover-ai/blob/main/lama_inpaint/runtime.py"
click node_lama_processing "https://github.com/d-ogi/watermarkremover-ai/blob/main/lama_inpaint/processing.py"
click node_lama_store "https://github.com/d-ogi/watermarkremover-ai/blob/main/lama_inpaint/model_store.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_desktop_entry,node_desktop_gui,node_web_ui,node_user toneBlue
class node_cli,node_detection,node_masking,node_media_processing toneAmber
class node_florence_assets,node_florence_service,node_lama_runtime,node_lama_processing,node_lama_store,node_lama_service toneMint
class node_model_worker,node_runtime_config toneRose
```

## Components

### User interfaces

- [Desktop entry](https://github.com/d-ogi/watermarkremover-ai/blob/main/desktop_main.py): `desktop_main.py`
- [Desktop GUI bridge](https://github.com/d-ogi/watermarkremover-ai/blob/main/remwmgui.py): `remwmgui.py`
- [Web UI](https://github.com/d-ogi/watermarkremover-ai/blob/main/ui/index.html): `ui/index.html`

### Detection and removal

- [CLI workflow](https://github.com/d-ogi/watermarkremover-ai/blob/main/remwm.py): `remwm.py`
- [Watermark detection](https://github.com/d-ogi/watermarkremover-ai/blob/main/remwm.py): `remwm.py`
- [Mask construction](https://github.com/d-ogi/watermarkremover-ai/blob/main/remwm.py): `remwm.py`
- [Image and video processing](https://github.com/d-ogi/watermarkremover-ai/blob/main/remwm.py): `remwm.py`

### Model preparation

- [Florence assets](https://github.com/d-ogi/watermarkremover-ai/blob/main/model_assets.py): `model_assets.py`
- **Hugging Face model source**
- [LaMA inference](https://github.com/d-ogi/watermarkremover-ai/blob/main/lama_inpaint/runtime.py): `lama_inpaint/runtime.py`
- [Inpaint crop and composite](https://github.com/d-ogi/watermarkremover-ai/blob/main/lama_inpaint/processing.py): `lama_inpaint/processing.py`
- [Verified LaMA cache](https://github.com/d-ogi/watermarkremover-ai/blob/main/lama_inpaint/model_store.py): `lama_inpaint/model_store.py`
- **LaMA model source**

### Desktop runtime

- [Model preparation worker](https://github.com/d-ogi/watermarkremover-ai/blob/main/desktop_models.py): `desktop_models.py`
- [Runtime paths and workers](https://github.com/d-ogi/watermarkremover-ai/blob/main/desktop_runtime.py): `desktop_runtime.py`

### Other components

- **User**

## Connections

- User → Desktop entry: launches (evidence: `README.md`)
- User → CLI workflow: invokes (evidence: `README.md`)
- Desktop entry → Desktop GUI bridge: starts (evidence: `desktop_main.py`)
- Web UI → Desktop GUI bridge: calls bridge
- Desktop GUI bridge → Model preparation worker: prepares models (evidence: `remwmgui.py`)
- Model preparation worker → Runtime paths and workers: uses worker settings (evidence: `desktop_models.py`)
- Model preparation worker → Florence assets: runs preparation (evidence: `desktop_models.py`)
- Florence assets → Hugging Face model source: downloads (evidence: `model_assets.py`)
- Desktop GUI bridge → CLI workflow: starts processing (evidence: `remwmgui.py`)
- CLI workflow → Florence assets: loads detection assets (evidence: `remwm.py`)
- CLI workflow → Watermark detection: runs detection (evidence: `remwm.py`)
- Watermark detection → Mask construction: builds masks (evidence: `remwm.py`)
- CLI workflow → Image and video processing: processes media (evidence: `remwm.py`)
- Image and video processing → LaMA inference: inpaints regions (evidence: `remwm.py`)
- LaMA inference → Verified LaMA cache: verifies and loads (evidence: `lama_inpaint/runtime.py`)
- LaMA inference → Inpaint crop and composite: delegates compositing (evidence: `lama_inpaint/runtime.py`)
- Verified LaMA cache → LaMA model source: downloads weights (evidence: `lama_inpaint/model_store.py`)
