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()