# lllyasviel/luminabrush architecture

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

- Interactive diagram: https://gitdiagram.com/lllyasviel/luminabrush
- Repository: https://github.com/lllyasviel/luminabrush

## Overview

##### Project Type and Purpose
- LuminaBrush is an interactive image editing tool specifically designed to add illumination effects on images.
- The tool uses a two-stage framework:
– The first stage processes an image to generate a “uniformly-lit” version (making the image appear as if lit by uniformly distributed white ambient light).
– The second stage uses user-drawn scribbles to generate customized illumination effects on top of the uniform base.
- The README also indicates integration with Flux and demos hosted on HuggingFace Spaces, which means there’s both machine learning model processing and an interactive front-end component.

##### Analyzing the File Structure
- Although the file tree is minimal, it shows that the repository is in an early work-in-progress state.
- The main logic, models, UI, and processing tools are likely contained in other modules or might be added later.
- We must therefore base our design on the documented architecture in the README rather than any extensive file structure.

##### Key Architectural Elements (from the README)
- Main Processing Stages:
– Stage 1: Conversion to “Uniformly-lit” Appearance.
– Stage 2: Generation of Illumination Effects guided by User Scribbles.
- Additional Components:
– A user interface component (front-end) allowing interactive input (e.g., uploading images and drawing scribbles).
– A backend component which hosts the machine learning models and image processing pipelines (possibly running Flux as the underlying framework).
– Data pipelines for training: The README describes collection of well-lit images and even synthesizing random normals for relighting. This implies a training/processing data preparation pipeline.
– External Deployment/Demo: Connection to HF spaces for interactive demos.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Project Metadata Subgraph
    subgraph "Project Metadata"
        PD["Project Documentation"]:::meta
        VC["Version Control & Ignore Settings"]:::meta
    end

    %% Main System Architecture
    subgraph "LuminaBrush System Architecture"
        UI["User Interface (Interactive Frontend)"]:::frontend
        subgraph "Processing Pipeline"
            S1["Stage 1: Uniform Illumination Converter\n(Flux LoRA trained models)"]:::backend
            S2["Stage 2: Illumination Effect Generator\n(User Scribble Guidance)"]:::backend
        end
        DPT["Data Pipeline/Model Trainer\n(Data Collection & Training)"]:::datapipeline
        EX["External Demo Service\n(HuggingFace Spaces)"]:::external
    end

    %% Data Flow
    UI -->|"uploads image"| S1
    UI -->|"provides scribbles"| S2
    S1 -->|"uniformly-lit output"| S2
    S2 -->|"final illuminated image"| UI

    %% Training data flow
    DPT -->|"trains model"| S1

    %% External Integration
    UI -->|"demo interface"| EX

    %% Click Events
    click PD "https://github.com/lllyasviel/luminabrush/blob/main/README.md"
    click VC "https://github.com/lllyasviel/luminabrush/blob/main/.gitignore"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#00008B,stroke-width:2px;
    classDef backend fill:#E6E6FA,stroke:#4B0082,stroke-width:2px;
    classDef datapipeline fill:#98FB98,stroke:#006400,stroke-width:2px;
    classDef external fill:#FFD700,stroke:#B8860B,stroke-width:2px;
    classDef meta fill:#D3D3D3,stroke:#696969,stroke-width:2px;
```
