File size: 829 Bytes
0b29680 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import gradio as gr
import rembg
from PIL import Image
def remove_background(input_image):
"""Remove background from image"""
if input_image is None:
return None
# Remove background using AI
output_image = rembg.remove(input_image)
return output_image
# Create the Gradio interface
demo = gr.Interface(
fn=remove_background,
inputs=gr.Image(type="pil", label="📷 Upload Image"),
outputs=gr.Image(type="pil", label="🎨 Background Removed"),
title="AI Background Remover",
description="Upload any image to automatically remove the background. Perfect for e-commerce, marketing, and content creation!",
examples=[
["example1.jpg"], # We'll add these later
["example2.jpg"],
["example3.jpg"]
]
)
if __name__ == "__main__":
demo.launch() |