File size: 840 Bytes
a135247
 
 
 
 
39806d4
a135247
 
 
 
f036466
caab2d1
39806d4
 
 
 
 
 
a79c124
447398e
441db3c
7680d35
8cf25b1
c13a18d
39806d4
0085f7f
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
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.',
                    
                    )

img = Image.open(r"https://media.geeksforgeeks.org/wp-content/uploads/20210318103632/gfg-300x300.png")    
img.show()
# Launch the interface
iface.launch()