16
16
def adjust_brightness (inpt : DType , brightness_factor : float ) -> DType :
17
17
if isinstance (inpt , features ._Feature ):
18
18
return inpt .adjust_brightness (brightness_factor = brightness_factor )
19
- if isinstance (inpt , PIL .Image .Image ):
19
+ elif isinstance (inpt , PIL .Image .Image ):
20
20
return adjust_brightness_image_pil (inpt , brightness_factor = brightness_factor )
21
- return adjust_brightness_image_tensor (inpt , brightness_factor = brightness_factor )
21
+ else :
22
+ return adjust_brightness_image_tensor (inpt , brightness_factor = brightness_factor )
22
23
23
24
24
25
adjust_saturation_image_tensor = _FT .adjust_saturation
@@ -28,9 +29,10 @@ def adjust_brightness(inpt: DType, brightness_factor: float) -> DType:
28
29
def adjust_saturation (inpt : DType , saturation_factor : float ) -> DType :
29
30
if isinstance (inpt , features ._Feature ):
30
31
return inpt .adjust_saturation (saturation_factor = saturation_factor )
31
- if isinstance (inpt , PIL .Image .Image ):
32
+ elif isinstance (inpt , PIL .Image .Image ):
32
33
return adjust_saturation_image_pil (inpt , saturation_factor = saturation_factor )
33
- return adjust_saturation_image_tensor (inpt , saturation_factor = saturation_factor )
34
+ else :
35
+ return adjust_saturation_image_tensor (inpt , saturation_factor = saturation_factor )
34
36
35
37
36
38
adjust_contrast_image_tensor = _FT .adjust_contrast
@@ -40,9 +42,10 @@ def adjust_saturation(inpt: DType, saturation_factor: float) -> DType:
40
42
def adjust_contrast (inpt : DType , contrast_factor : float ) -> DType :
41
43
if isinstance (inpt , features ._Feature ):
42
44
return inpt .adjust_contrast (contrast_factor = contrast_factor )
43
- if isinstance (inpt , PIL .Image .Image ):
45
+ elif isinstance (inpt , PIL .Image .Image ):
44
46
return adjust_contrast_image_pil (inpt , contrast_factor = contrast_factor )
45
- return adjust_contrast_image_tensor (inpt , contrast_factor = contrast_factor )
47
+ else :
48
+ return adjust_contrast_image_tensor (inpt , contrast_factor = contrast_factor )
46
49
47
50
48
51
adjust_sharpness_image_tensor = _FT .adjust_sharpness
@@ -52,9 +55,10 @@ def adjust_contrast(inpt: DType, contrast_factor: float) -> DType:
52
55
def adjust_sharpness (inpt : DType , sharpness_factor : float ) -> DType :
53
56
if isinstance (inpt , features ._Feature ):
54
57
return inpt .adjust_sharpness (sharpness_factor = sharpness_factor )
55
- if isinstance (inpt , PIL .Image .Image ):
58
+ elif isinstance (inpt , PIL .Image .Image ):
56
59
return adjust_sharpness_image_pil (inpt , sharpness_factor = sharpness_factor )
57
- return adjust_sharpness_image_tensor (inpt , sharpness_factor = sharpness_factor )
60
+ else :
61
+ return adjust_sharpness_image_tensor (inpt , sharpness_factor = sharpness_factor )
58
62
59
63
60
64
adjust_hue_image_tensor = _FT .adjust_hue
@@ -64,9 +68,10 @@ def adjust_sharpness(inpt: DType, sharpness_factor: float) -> DType:
64
68
def adjust_hue (inpt : DType , hue_factor : float ) -> DType :
65
69
if isinstance (inpt , features ._Feature ):
66
70
return inpt .adjust_hue (hue_factor = hue_factor )
67
- if isinstance (inpt , PIL .Image .Image ):
71
+ elif isinstance (inpt , PIL .Image .Image ):
68
72
return adjust_hue_image_pil (inpt , hue_factor = hue_factor )
69
- return adjust_hue_image_tensor (inpt , hue_factor = hue_factor )
73
+ else :
74
+ return adjust_hue_image_tensor (inpt , hue_factor = hue_factor )
70
75
71
76
72
77
adjust_gamma_image_tensor = _FT .adjust_gamma
@@ -76,9 +81,10 @@ def adjust_hue(inpt: DType, hue_factor: float) -> DType:
76
81
def adjust_gamma (inpt : DType , gamma : float , gain : float = 1 ) -> DType :
77
82
if isinstance (inpt , features ._Feature ):
78
83
return inpt .adjust_gamma (gamma = gamma , gain = gain )
79
- if isinstance (inpt , PIL .Image .Image ):
84
+ elif isinstance (inpt , PIL .Image .Image ):
80
85
return adjust_gamma_image_pil (inpt , gamma = gamma , gain = gain )
81
- return adjust_gamma_image_tensor (inpt , gamma = gamma , gain = gain )
86
+ else :
87
+ return adjust_gamma_image_tensor (inpt , gamma = gamma , gain = gain )
82
88
83
89
84
90
posterize_image_tensor = _FT .posterize
@@ -88,9 +94,10 @@ def adjust_gamma(inpt: DType, gamma: float, gain: float = 1) -> DType:
88
94
def posterize (inpt : DType , bits : int ) -> DType :
89
95
if isinstance (inpt , features ._Feature ):
90
96
return inpt .posterize (bits = bits )
91
- if isinstance (inpt , PIL .Image .Image ):
97
+ elif isinstance (inpt , PIL .Image .Image ):
92
98
return posterize_image_pil (inpt , bits = bits )
93
- return posterize_image_tensor (inpt , bits = bits )
99
+ else :
100
+ return posterize_image_tensor (inpt , bits = bits )
94
101
95
102
96
103
solarize_image_tensor = _FT .solarize
@@ -100,9 +107,10 @@ def posterize(inpt: DType, bits: int) -> DType:
100
107
def solarize (inpt : DType , threshold : float ) -> DType :
101
108
if isinstance (inpt , features ._Feature ):
102
109
return inpt .solarize (threshold = threshold )
103
- if isinstance (inpt , PIL .Image .Image ):
110
+ elif isinstance (inpt , PIL .Image .Image ):
104
111
return solarize_image_pil (inpt , threshold = threshold )
105
- return solarize_image_tensor (inpt , threshold = threshold )
112
+ else :
113
+ return solarize_image_tensor (inpt , threshold = threshold )
106
114
107
115
108
116
autocontrast_image_tensor = _FT .autocontrast
@@ -112,9 +120,10 @@ def solarize(inpt: DType, threshold: float) -> DType:
112
120
def autocontrast (inpt : DType ) -> DType :
113
121
if isinstance (inpt , features ._Feature ):
114
122
return inpt .autocontrast ()
115
- if isinstance (inpt , PIL .Image .Image ):
123
+ elif isinstance (inpt , PIL .Image .Image ):
116
124
return autocontrast_image_pil (inpt )
117
- return autocontrast_image_tensor (inpt )
125
+ else :
126
+ return autocontrast_image_tensor (inpt )
118
127
119
128
120
129
equalize_image_tensor = _FT .equalize
@@ -124,9 +133,10 @@ def autocontrast(inpt: DType) -> DType:
124
133
def equalize (inpt : DType ) -> DType :
125
134
if isinstance (inpt , features ._Feature ):
126
135
return inpt .equalize ()
127
- if isinstance (inpt , PIL .Image .Image ):
136
+ elif isinstance (inpt , PIL .Image .Image ):
128
137
return equalize_image_pil (inpt )
129
- return equalize_image_tensor (inpt )
138
+ else :
139
+ return equalize_image_tensor (inpt )
130
140
131
141
132
142
invert_image_tensor = _FT .invert
@@ -136,6 +146,7 @@ def equalize(inpt: DType) -> DType:
136
146
def invert (inpt : DType ) -> DType :
137
147
if isinstance (inpt , features ._Feature ):
138
148
return inpt .invert ()
139
- if isinstance (inpt , PIL .Image .Image ):
149
+ elif isinstance (inpt , PIL .Image .Image ):
140
150
return invert_image_pil (inpt )
141
- return invert_image_tensor (inpt )
151
+ else :
152
+ return invert_image_tensor (inpt )
0 commit comments