Update app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
from rembg import remove
|
3 |
|
4 |
-
# ๋ฐฐ๊ฒฝ์ ์ ๊ฑฐํ๋ ํจ์๋ฅผ ์ ์ํฉ๋๋ค.
|
5 |
def remove_background(image):
|
6 |
output_image = remove(image)
|
7 |
return output_image
|
8 |
|
9 |
-
# Gradio ์ธํฐํ์ด์ค๋ฅผ ์์ฑํฉ๋๋ค.
|
10 |
with gr.Blocks() as demo:
|
11 |
with gr.Row():
|
12 |
-
|
13 |
-
image_input = gr.Image(type="pil", tool="editor")
|
14 |
-
# ๋ฐฐ๊ฒฝ์ด ์ ๊ฑฐ๋ ์ด๋ฏธ์ง๋ฅผ ๋ณด์ฌ์ฃผ๋ ์ปดํฌ๋ํธ๋ฅผ ์ถ๊ฐํฉ๋๋ค.
|
15 |
image_output = gr.Image(type="pil")
|
16 |
|
17 |
-
# ์ฌ์ฉ์๊ฐ ์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํ๋ฉด `remove_background` ํจ์๊ฐ ํธ์ถ๋์ด ๊ฒฐ๊ณผ๋ฅผ ๋ณด์ฌ์ค๋๋ค.
|
18 |
image_input.change(fn=remove_background, inputs=image_input, outputs=image_output)
|
19 |
|
20 |
-
# ์ฑ์ ์คํํฉ๋๋ค.
|
21 |
if __name__ == "__main__":
|
22 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from rembg import remove
|
3 |
|
|
|
4 |
def remove_background(image):
|
5 |
output_image = remove(image)
|
6 |
return output_image
|
7 |
|
|
|
8 |
with gr.Blocks() as demo:
|
9 |
with gr.Row():
|
10 |
+
image_input = gr.Image(type="pil")
|
|
|
|
|
11 |
image_output = gr.Image(type="pil")
|
12 |
|
|
|
13 |
image_input.change(fn=remove_background, inputs=image_input, outputs=image_output)
|
14 |
|
|
|
15 |
if __name__ == "__main__":
|
16 |
demo.launch()
|