# sirioberati/genjustsu-open-source-workflow architecture

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

- Interactive diagram: https://gitdiagram.com/sirioberati/genjustsu-open-source-workflow
- Repository: https://github.com/sirioberati/genjustsu-open-source-workflow

## Overview

Genjustsu is a local video subject-replacement workflow with a browser UI and agent CLI. Users prepare a clip in depth, face-mesh, or combined mode; inspect and approve the prepared artifacts; submit an authorized Seedance draft with character references; then review the result and optionally approve 1080p. The final preview restores the full original soundtrack. The graph follows documented capabilities and excerpted calls; unsampled implementation details are omitted where their connections cannot be verified.

Main entry points: [`pipeline.py`](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/pipeline.py) (Depth workflow), [`app.py`](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/app.py) (Job API), [`seedance_bridge.py`](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/seedance_bridge.py) (Seedance integration), [`face_mesh.py`](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/face_mesh.py) (Face mesh modes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Local entry points"]
  node_ui["Browser UI<br/>[index.html]"]
  node_server["Job API<br/>[app.py]"]
  node_cli["Agent CLI<br/>[workflow.py]"]
end

subgraph group_prepare["Video preparation"]
  node_depth_prep["Depth workflow<br/>[pipeline.py]"]
  node_masks["SAM masks<br/>[raw_masks.py]"]
  node_mesh["Face mesh modes<br/>[face_mesh.py]"]
  node_mesh_worker["Mesh tracking worker<br/>[mesh_worker.py]"]
  node_replicate{{"Replicate models"}}
  node_huggingface{{"Hugging Face depth"}}
end

subgraph group_review_audio["Review and audio"]
  node_audio["Audio processing<br/>[audio_workflow.py]"]
  node_review["Artifact approval<br/>[mask_review.py]"]
  node_job_files[("Job artifacts<br/>[app.py]")]
end

subgraph group_generation["Generation and results"]
  node_bridge["Seedance integration<br/>[seedance_bridge.py]"]
  node_hosting["Media URL hosting<br/>[media_host.py]"]
  node_callback["Callback receiver<br/>[webhook.py]"]
  node_enhancor{{"Enhancor Seedance"}}
  node_media_services{{"Media hosts"}}
  node_preview["Final preview<br/>[audio_workflow.py]"]
end

node_user(("User or agent"))

node_user -->|"uses"| node_ui
node_user -->|"operates"| node_cli
node_ui -->|"submits jobs"| node_server
node_server -->|"runs depth mode"| node_depth_prep
node_server -->|"runs mesh mode"| node_mesh
node_cli -->|"prepares depth"| node_depth_prep
node_cli -->|"prepares mesh"| node_mesh
node_depth_prep -->|"requests masks"| node_masks
node_depth_prep -->|"requests depth or masks"| node_replicate
node_depth_prep -.->|"requests depth"| node_huggingface
node_mesh -->|"runs combined mode"| node_depth_prep
node_mesh -->|"launches tracking"| node_mesh_worker
node_depth_prep -->|"separates source audio"| node_audio
node_mesh -->|"prepares vocals"| node_audio
node_server -->|"checks approval"| node_review
node_cli -->|"reviews artifacts"| node_review
node_server -->|"submits draft or HD"| node_bridge
node_bridge -->|"requires approval"| node_review
node_bridge -->|"prepares and restores audio"| node_audio
node_bridge -->|"uploads media"| node_hosting
node_hosting -->|"uploads files"| node_media_services
node_bridge -->|"queues and polls"| node_enhancor
node_callback -.->|"receives callback traffic"| node_enhancor
node_audio -->|"restores original audio"| node_preview
node_server -->|"serves job results"| node_preview

click node_ui "https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/static/index.html"
click node_server "https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/app.py"
click node_cli "https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/workflow.py"
click node_depth_prep "https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/pipeline.py"
click node_masks "https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/raw_masks.py"
click node_mesh "https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/face_mesh.py"
click node_mesh_worker "https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/mesh_worker.py"
click node_audio "https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/audio_workflow.py"
click node_review "https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/mask_review.py"
click node_job_files "https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/app.py"
click node_bridge "https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/seedance_bridge.py"
click node_hosting "https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/media_host.py"
click node_callback "https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/webhook.py"
click node_preview "https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/audio_workflow.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_ui,node_server,node_cli,node_user toneBlue
class node_depth_prep,node_masks,node_mesh,node_mesh_worker,node_replicate,node_huggingface toneAmber
class node_audio,node_review,node_job_files toneMint
class node_bridge,node_hosting,node_callback,node_enhancor,node_media_services,node_preview toneRose
```

## Components

### Local entry points

- [Browser UI](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/static/index.html): `static/index.html`
- [Job API](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/app.py): `app.py`
- [Agent CLI](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/workflow.py): `workflow.py`

### Video preparation

- [Depth workflow](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/pipeline.py): `pipeline.py`
- [SAM masks](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/raw_masks.py): `raw_masks.py`
- [Face mesh modes](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/face_mesh.py): `face_mesh.py`
- [Mesh tracking worker](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/mesh_worker.py): `mesh_worker.py`
- **Replicate models**
- **Hugging Face depth**

### Review and audio

- [Audio processing](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/audio_workflow.py): `audio_workflow.py`
- [Artifact approval](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/mask_review.py): `mask_review.py`
- [Job artifacts](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/app.py): `app.py`

### Generation and results

- [Seedance integration](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/seedance_bridge.py): `seedance_bridge.py`
- [Media URL hosting](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/media_host.py): `media_host.py`
- [Callback receiver](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/webhook.py): `webhook.py`
- **Enhancor Seedance**
- **Media hosts**
- [Final preview](https://github.com/sirioberati/genjustsu-open-source-workflow/blob/main/audio_workflow.py): `audio_workflow.py`

### Other components

- **User or agent**

## Connections

- User or agent → Browser UI: uses (evidence: `README.md`)
- User or agent → Agent CLI: operates (evidence: `README.md`)
- Browser UI → Job API: submits jobs (evidence: `README.md`)
- Job API → Depth workflow: runs depth mode (evidence: `app.py`)
- Job API → Face mesh modes: runs mesh mode (evidence: `app.py`)
- Agent CLI → Depth workflow: prepares depth (evidence: `workflow.py`)
- Agent CLI → Face mesh modes: prepares mesh (evidence: `workflow.py`)
- Depth workflow → SAM masks: requests masks (evidence: `pipeline.py`)
- Depth workflow → Replicate models: requests depth or masks (evidence: `pipeline.py`)
- Depth workflow → Hugging Face depth: requests depth (evidence: `README.md`)
- Face mesh modes → Depth workflow: runs combined mode (evidence: `face_mesh.py`)
- Face mesh modes → Mesh tracking worker: launches tracking (evidence: `face_mesh.py`)
- Depth workflow → Audio processing: separates source audio (evidence: `pipeline.py`)
- Face mesh modes → Audio processing: prepares vocals (evidence: `face_mesh.py`)
- Job API → Artifact approval: checks approval (evidence: `app.py`)
- Agent CLI → Artifact approval: reviews artifacts (evidence: `workflow.py`)
- Job API → Seedance integration: submits draft or HD (evidence: `app.py`)
- Seedance integration → Artifact approval: requires approval (evidence: `seedance_bridge.py`)
- Seedance integration → Audio processing: prepares and restores audio (evidence: `seedance_bridge.py`)
- Seedance integration → Media URL hosting: uploads media (evidence: `seedance_bridge.py`)
- Media URL hosting → Media hosts: uploads files (evidence: `media_host.py`)
- Seedance integration → Enhancor Seedance: queues and polls (evidence: `seedance_bridge.py`)
- Callback receiver → Enhancor Seedance: receives callback traffic (evidence: `README.md`)
- Audio processing → Final preview: restores original audio (evidence: `audio_workflow.py`)
- Job API → Final preview: serves job results (evidence: `app.py`)
