File size: 1,583 Bytes
c31821c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
56
from scripts.utils import visualize_inpaint_mask
from ..supported_preprocessor import Preprocessor, PreprocessorParameter


class PreprocessorInpaint(Preprocessor):
    def __init__(self):
        super().__init__(name="inpaint")
        self._label = "inpaint_global_harmonious"
        self.tags = ["Inpaint"]
        self.slider_resolution = PreprocessorParameter(visible=False)
        self.sorting_priority = 0
        self.accepts_mask = True
        self.requires_mask = True

    def __call__(
        self,
        input_image,
        resolution,
        slider_1=None,
        slider_2=None,
        slider_3=None,
        **kwargs
    ):
        return Preprocessor.Result(
            value=input_image,
            display_images=visualize_inpaint_mask(input_image)[None, :, :, :],
        )


class PreprocessorInpaintOnly(Preprocessor):
    def __init__(self):
        super().__init__(name="inpaint_only")
        self.tags = ["Inpaint"]
        self.slider_resolution = PreprocessorParameter(visible=False)
        self.sorting_priority = 100
        self.accepts_mask = True
        self.requires_mask = True

    def __call__(
        self,
        input_image,
        resolution,
        slider_1=None,
        slider_2=None,
        slider_3=None,
        **kwargs
    ):
        return Preprocessor.Result(
            value=input_image,
            display_images=visualize_inpaint_mask(input_image)[None, :, :, :],
        )


Preprocessor.add_supported_preprocessor(PreprocessorInpaint())
Preprocessor.add_supported_preprocessor(PreprocessorInpaintOnly())