import gradio as gr | |
from rembg import remove | |
def remove_background(input_image): | |
output_image = remove(input_image.read()) | |
return output_image | |
with gr.Blocks() as demo: | |
gr.Markdown("### 배경 이미지 제거 프로그램") | |
with gr.Row(): | |
with gr.Column(): | |
input_image = gr.Image(type="pil", label="원본 이미지") | |
output_image = gr.Image(type="pil", label="배경 제거 이미지") | |
with gr.Column(): | |
gr.Button("배경 제거").click(remove_background, inputs=input_image, outputs=output_image) | |
if __name__ == "__main__": | |
demo.launch() |