karthikcmani commited on
Commit
d1774e4
·
verified ·
1 Parent(s): e144d67

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +20 -0
  2. requirements.txt +7 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from rembg import remove
3
+ from PIL import Image
4
+ import io
5
+
6
+ def remove_bg(image):
7
+ img_bytes = io.BytesIO()
8
+ image.save(img_bytes, format='PNG')
9
+ result = remove(img_bytes.getvalue())
10
+ return Image.open(io.BytesIO(result))
11
+
12
+ demo = gr.Interface(
13
+ fn=remove_bg,
14
+ inputs=gr.Image(type="pil", label="Upload an Image"),
15
+ outputs=gr.Image(label="Background Removed"),
16
+ title="AI Background Remover",
17
+ description="Upload any image to remove its background instantly using Rembg!"
18
+ )
19
+
20
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ gradio
2
+ rembg
3
+ pillow
4
+ numpy
5
+ onnxruntime
6
+ filetype
7
+ click