rishi9440's picture
Duplicate from asim266/image-background-remover
a135247
raw
history blame
680 Bytes
import gradio as gr
from rembg import remove
from PIL import Image
def remove_background(input_image):
input = Image.open(input_image) # load image
output = remove(input) # remove background
return output
input_image = gr.inputs.Image(type="filepath", label="Input Image")
output_image = gr.inputs.Image(type="filepath", label="Output Image")
# Create a Gradio interface
iface = gr.Interface(remove_background,
inputs=input_image,
outputs=output_image,
title='Image Background Remover',
description='Upload an image and it will remove.')
# Launch the interface
iface.launch()