File size: 2,195 Bytes
0ed6b0e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Inference WebUI

DiffSynth-Studio provides an Inference WebUI to help developers quickly validate model performance.

> The current Inference WebUI is not fully developed yet; we will optimize the interaction logic in the future.

> The Inference WebUI is a debugging tool designed for developers, not a creation tool for end-users. For a richer feature set and more user-friendly interactive experience, we recommend using the [AIGC Zone](https://modelscope.cn/aigc/home) on ModelScope (for users in China) or the [Civision Zone](https://modelscope.ai/civision/home) (for users outside China).

## Launching the Inference WebUI

The Inference WebUI is built on [`Streamlit`](https://streamlit.io/). In addition to DiffSynth-Studio, you also need to install `Streamlit`:

```shell
git clone https://github.com/modelscope/DiffSynth-Studio.git
cd DiffSynth-Studio
pip install -e .
pip install streamlit
```

Launch command:

```shell
streamlit run examples/dev_tools/webui.py --server.fileWatcherType none
```

## How It Works

As a standalone tool, the Inference WebUI dynamically generates corresponding UI controls by parsing the type annotations of parameters in the Pipeline's `from_pretrained` and `__call__` methods. Therefore, the interface interaction logic is fully consistent with the code invocation logic, serving as a visual entry point for DiffSynth-Studio code.

Taking `ZImagePipeline.__call__` in `diffsynth.pipelines.z_image` as an example:

```python
@torch.no_grad()
def __call__(
    self,
    # Prompt
    prompt: str = "",
    negative_prompt: str = "",
    cfg_scale: float = 1.0,
    # Image
    input_image: Image.Image = None,
    denoising_strength: float = 1.0,
    ...
)
```

After parsing, the WebUI will automatically render the following interface:

![](https://github.com/user-attachments/assets/55795022-7a9b-4383-b048-7feabdfcdddf)

## Usage Tips

- Supports automatic loading of model information such as `model_id` and `origin_file_pattern` from sample code in `./examples`, simplifying the configuration process;
- Parameters such as `vram_limit`, `tokenizer_config`, and `lora` cannot be retrieved through code parsing and need to be filled in manually.