| import gradio as gr | |
| from PIL import Image | |
| from u2net_utils import remove_background | |
| def process(image): | |
| result = remove_background(image) | |
| return result | |
| demo = gr.Interface( | |
| fn=process, | |
| inputs=gr.Image(type="pil"), | |
| outputs=gr.Image(type="pil"), | |
| title="Remove Background", | |
| description="Upload an image and remove the background using U²-Net." | |
| ) | |
| demo.launch() | |