tori29umai commited on
Commit
9509e00
1 Parent(s): 9c33ed5
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -138,6 +138,9 @@ def line_color(image, mask, new_color):
138
 
139
 
140
  def main(image, lineart):
 
 
 
141
  lineart = lineart.point(lambda x: 0 if x < 200 else 255)
142
  lineart = ImageOps.invert(lineart)
143
  kernel = np.ones((3, 3), np.uint8)
@@ -149,7 +152,7 @@ def main(image, lineart):
149
  new_color_1 = generate_distant_colors(major_colors, 100)
150
  filled_image = line_color(image, mask, new_color_1)
151
  replace_color_image = replace_color(filled_image, new_color_1, 2).convert('RGB')
152
- return replace_color_image
153
 
154
 
155
  # Gradioインターフェース用のメイン関数
 
138
 
139
 
140
  def main(image, lineart):
141
+ if image.mode != 'RGBA':
142
+ image = image.convert('RGBA')
143
+
144
  lineart = lineart.point(lambda x: 0 if x < 200 else 255)
145
  lineart = ImageOps.invert(lineart)
146
  kernel = np.ones((3, 3), np.uint8)
 
152
  new_color_1 = generate_distant_colors(major_colors, 100)
153
  filled_image = line_color(image, mask, new_color_1)
154
  replace_color_image = replace_color(filled_image, new_color_1, 2).convert('RGB')
155
+ return replace_color_image
156
 
157
 
158
  # Gradioインターフェース用のメイン関数