Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from rembg import remove | |
| from PIL import Image | |
| import numpy as np | |
| def remove_bg(input_image): | |
| if input_image is None: | |
| return None | |
| input_image = Image.open(input_image).convert("RGBA") # Ensure RGBA format | |
| output_image = remove(input_image) # Remove background | |
| return output_image | |
| iface = gr.Interface( | |
| fn=remove_bg, | |
| inputs=gr.Image(type="filepath", label="Upload an Image"), | |
| outputs=gr.Image(type="pil", label="Background Removed Image"), | |
| title="AI Background Remover", | |
| description="Upload an image, and this tool will remove the background automatically.", | |
| ) | |
| iface.launch(share=True) |