Spaces:
Sleeping
Sleeping
File size: 550 Bytes
6649303 a54a7b1 6649303 a54a7b1 6649303 e838934 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from rembg import remove
from PIL import Image
import io
def remove_bg(image):
img_bytes = io.BytesIO()
image.save(img_bytes, format='PNG')
result = remove(img_bytes.getvalue())
return Image.open(io.BytesIO(result))
demo = gr.Interface(
fn=remove_bg,
inputs=gr.Image(type="pil", label="🖼️ Upload an Image"),
outputs=gr.Image(label="✨ Background Removed"),
title="🎨 AI Background Remover",
description="Upload an image and instantly remove the background using AI",
)
demo.launch()
|