karthikcmani's picture
Update app.py
a54a7b1 verified
raw
history blame contribute delete
550 Bytes
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()