remove-bg / app.py
Kvikontent's picture
Update app.py
f0f5cb9 verified
raw
history blame contribute delete
830 Bytes
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) # Remove the background using the rembg library
# No need to convert to BytesIO, just return the PIL Image object
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"
)
# Launch the interface
iface.launch(share=True)