| import gradio as gr | |
| from rembg import remove | |
| def remove_background(image): | |
| output_image = remove(image) | |
| return output_image | |
| with gr.Blocks() as demo: | |
| with gr.Row(): | |
| image_input = gr.Image(type="pil") | |
| image_output = gr.Image(type="pil") | |
| image_input.change(fn=remove_background, inputs=image_input, outputs=image_output) | |
| if __name__ == "__main__": | |
| demo.launch() |