Spaces:
Runtime error
Runtime error
tori29umai
commited on
Commit
·
131caab
1
Parent(s):
08351c4
Update
Browse files
app.py
CHANGED
@@ -154,23 +154,19 @@ 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アプリを設定し、起動する
|
175 |
iface = gr.Interface(
|
176 |
fn=gradio_interface,
|
|
|
154 |
image_path = 'temp_input_image.png'
|
155 |
image.save(image_path)
|
156 |
|
|
|
157 |
image = Image.open(image_path).convert('RGBA')
|
|
|
|
|
158 |
alpha = image.getchannel('A')
|
159 |
|
|
|
160 |
rgb_image = image.convert('RGB')
|
161 |
lineart = process_XDoG(image_path).convert('L')
|
162 |
replace_color_image = main(rgb_image, lineart)
|
163 |
+
|
|
|
164 |
replace_color_image = replace_color_image.convert('RGBA')
|
165 |
replace_color_image.putalpha(alpha)
|
166 |
|
167 |
return replace_color_image
|
168 |
|
169 |
+
|
170 |
# Gradioアプリを設定し、起動する
|
171 |
iface = gr.Interface(
|
172 |
fn=gradio_interface,
|