Spaces:
Runtime error
Runtime error
tori29umai
commited on
Commit
·
08351c4
1
Parent(s):
3b5e8c1
Update
Browse files
app.py
CHANGED
@@ -153,16 +153,22 @@ def main(image, lineart):
|
|
153 |
def gradio_interface(image):
|
154 |
image_path = 'temp_input_image.png'
|
155 |
image.save(image_path)
|
|
|
|
|
156 |
image = Image.open(image_path).convert('RGBA')
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
|
|
|
|
161 |
lineart = process_XDoG(image_path).convert('L')
|
162 |
-
replace_color_image = main(
|
163 |
-
|
164 |
-
|
165 |
-
|
|
|
|
|
166 |
return replace_color_image
|
167 |
|
168 |
# Gradioアプリを設定し、起動する
|
|
|
153 |
def gradio_interface(image):
|
154 |
image_path = 'temp_input_image.png'
|
155 |
image.save(image_path)
|
156 |
+
|
157 |
+
# 画像を再読込し、RGBAモードに変換する
|
158 |
image = Image.open(image_path).convert('RGBA')
|
159 |
+
|
160 |
+
# アルファチャンネルを分離する
|
161 |
+
alpha = image.getchannel('A')
|
162 |
+
|
163 |
+
# RGBチャンネルのみを処理する
|
164 |
+
rgb_image = image.convert('RGB')
|
165 |
lineart = process_XDoG(image_path).convert('L')
|
166 |
+
replace_color_image = main(rgb_image, lineart)
|
167 |
+
|
168 |
+
# 処理済みの画像をRGBAに変換し、アルファチャンネルを再適用する
|
169 |
+
replace_color_image = replace_color_image.convert('RGBA')
|
170 |
+
replace_color_image.putalpha(alpha)
|
171 |
+
|
172 |
return replace_color_image
|
173 |
|
174 |
# Gradioアプリを設定し、起動する
|