pipeline_output.py 1.12 KB
Newer Older
Dhruv Nair's avatar
Dhruv Nair committed
1
2
3
4
from dataclasses import dataclass
from typing import List, Optional, Union

import numpy as np
Anh71me's avatar
Anh71me committed
5
import PIL.Image
Dhruv Nair's avatar
Dhruv Nair committed
6
7
8
9
10
11

from ...utils import BaseOutput


@dataclass
class IFPipelineOutput(BaseOutput):
Yijun Lee's avatar
Yijun Lee committed
12
    r"""
Dhruv Nair's avatar
Dhruv Nair committed
13
    Output class for Stable Diffusion pipelines.
Yijun Lee's avatar
Yijun Lee committed
14
15
16

    Args:
        images (`List[PIL.Image.Image]` or `np.ndarray`):
Dhruv Nair's avatar
Dhruv Nair committed
17
18
            List of denoised PIL images of length `batch_size` or numpy array of shape `(batch_size, height, width,
            num_channels)`. PIL images or numpy array present the denoised images of the diffusion pipeline.
Yijun Lee's avatar
Yijun Lee committed
19
        nsfw_detected (`List[bool]`):
Dhruv Nair's avatar
Dhruv Nair committed
20
21
            List of flags denoting whether the corresponding generated image likely represents "not-safe-for-work"
            (nsfw) content or a watermark. `None` if safety checking could not be performed.
Yijun Lee's avatar
Yijun Lee committed
22
        watermark_detected (`List[bool]`):
Dhruv Nair's avatar
Dhruv Nair committed
23
24
25
26
27
28
29
            List of flags denoting whether the corresponding generated image likely has a watermark. `None` if safety
            checking could not be performed.
    """

    images: Union[List[PIL.Image.Image], np.ndarray]
    nsfw_detected: Optional[List[bool]]
    watermark_detected: Optional[List[bool]]