Spaces:
Running
Running
Commit
Β·
2e1c1e0
1
Parent(s):
42263c5
Update
Browse files
app.py
CHANGED
|
@@ -161,14 +161,15 @@ class webui:
|
|
| 161 |
def __init__(self):
|
| 162 |
self.demo = gr.Blocks()
|
| 163 |
|
| 164 |
-
def main(self, image_path
|
| 165 |
image = Image.open(image_path).convert('RGBA')
|
|
|
|
| 166 |
image_name = os.path.splitext(image_path)[0]
|
| 167 |
alpha = image.getchannel('A') if image.mode == 'RGBA' else None
|
| 168 |
image.save(image_path)
|
| 169 |
image = Image.open(image_path).convert('RGBA')
|
| 170 |
rgb_image = image.convert('RGB')
|
| 171 |
-
lineart = process_XDoG(image_path
|
| 172 |
replace_color_image = process_image(rgb_image, lineart).convert('RGBA')
|
| 173 |
|
| 174 |
if alpha:
|
|
@@ -196,10 +197,6 @@ class webui:
|
|
| 196 |
with gr.Row():
|
| 197 |
with gr.Column():
|
| 198 |
input_image = gr.Image(type='filepath', image_mode="RGBA", label="Original Image")
|
| 199 |
-
kernel_size_input = gr.Number(value=0, label="Kernel Size", precision=0)
|
| 200 |
-
sigma_input = gr.Number(value=1.0, label="Sigma")
|
| 201 |
-
k_sigma_input = gr.Number(value=2.0, label="K Sigma")
|
| 202 |
-
gamma_input = gr.Number(value=1.5, label="Gamma")
|
| 203 |
submit = gr.Button(value="Start")
|
| 204 |
with gr.Row():
|
| 205 |
with gr.Column():
|
|
@@ -208,7 +205,7 @@ class webui:
|
|
| 208 |
output_file = gr.File()
|
| 209 |
submit.click(
|
| 210 |
self.main,
|
| 211 |
-
inputs=[input_image
|
| 212 |
outputs=[output_0, output_file]
|
| 213 |
)
|
| 214 |
|
|
@@ -217,4 +214,4 @@ class webui:
|
|
| 217 |
|
| 218 |
if __name__ == "__main__":
|
| 219 |
ui = webui()
|
| 220 |
-
ui.launch(share=True)
|
|
|
|
| 161 |
def __init__(self):
|
| 162 |
self.demo = gr.Blocks()
|
| 163 |
|
| 164 |
+
def main(self, image_path):
|
| 165 |
image = Image.open(image_path).convert('RGBA')
|
| 166 |
+
#ζ‘εΌ΅εγεγι€γγγγ‘γ€γ«εγεεΎ
|
| 167 |
image_name = os.path.splitext(image_path)[0]
|
| 168 |
alpha = image.getchannel('A') if image.mode == 'RGBA' else None
|
| 169 |
image.save(image_path)
|
| 170 |
image = Image.open(image_path).convert('RGBA')
|
| 171 |
rgb_image = image.convert('RGB')
|
| 172 |
+
lineart = process_XDoG(image_path).convert('L')
|
| 173 |
replace_color_image = process_image(rgb_image, lineart).convert('RGBA')
|
| 174 |
|
| 175 |
if alpha:
|
|
|
|
| 197 |
with gr.Row():
|
| 198 |
with gr.Column():
|
| 199 |
input_image = gr.Image(type='filepath', image_mode="RGBA", label="Original Image")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
submit = gr.Button(value="Start")
|
| 201 |
with gr.Row():
|
| 202 |
with gr.Column():
|
|
|
|
| 205 |
output_file = gr.File()
|
| 206 |
submit.click(
|
| 207 |
self.main,
|
| 208 |
+
inputs=[input_image],
|
| 209 |
outputs=[output_0, output_file]
|
| 210 |
)
|
| 211 |
|
|
|
|
| 214 |
|
| 215 |
if __name__ == "__main__":
|
| 216 |
ui = webui()
|
| 217 |
+
ui.launch(share=True)
|