|
import gradio as gr |
|
from rembg import remove |
|
from PIL import Image |
|
import io |
|
import spaces |
|
|
|
@spaces.GPU(duration=20) |
|
def background_remover(input_image): |
|
output_img = remove(input_image) |
|
|
|
return output_img |
|
|
|
description = """ |
|
This app uses the rembg library to remove the background from uploaded images. |
|
Simply upload your image and let the model do its work. Download the result immediately after! |
|
""" |
|
|
|
iface = gr.Interface( |
|
fn=background_remover, |
|
inputs=gr.Image(type='pil', label="Upload Image"), |
|
outputs="image", |
|
examples=["woman.jpg", "groot.jpg"], |
|
title="✨ Background Remover", |
|
description=description, |
|
theme="soft" |
|
) |
|
|
|
|
|
|
|
iface.launch(share=True) |
|
|