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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -20
app.py CHANGED
@@ -1,20 +1,21 @@
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()
 
 
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="A sleek AI tool to instantly remove backgrounds from your images using **Rembg**. Just upload and magic happens ✨",
18
+ theme=gr.themes.Soft(primary_hue="emerald", secondary_hue="teal")
19
+ )
20
+
21
+ demo.launch()