VINU NAYAK commited on
Commit
bb1e2a4
·
verified ·
1 Parent(s): e443f31

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from rembg import remove
3
+ from PIL import Image
4
+ import io
5
+
6
+ def remove_background(input_image):
7
+ if isinstance(input_image, str):
8
+ input_image = Image.open(input_image)
9
+ output_image = remove(input_image)
10
+ return output_image
11
+
12
+ demo = gr.Interface(
13
+ fn=remove_background,
14
+ inputs=gr.Image(type="pil"),
15
+ outputs=gr.Image(type="pil"),
16
+ title="Background Remover",
17
+ description="Upload an image to remove its background",
18
+ examples=[],
19
+ theme=gr.themes.Soft()
20
+ )
21
+
22
+ if __name__ == "__main__":
23
+ demo.launch()