Tas01 commited on
Commit
0b29680
·
verified ·
1 Parent(s): b0eaea1

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import rembg
3
+ from PIL import Image
4
+
5
+ def remove_background(input_image):
6
+ """Remove background from image"""
7
+ if input_image is None:
8
+ return None
9
+
10
+ # Remove background using AI
11
+ output_image = rembg.remove(input_image)
12
+ return output_image
13
+
14
+ # Create the Gradio interface
15
+ demo = gr.Interface(
16
+ fn=remove_background,
17
+ inputs=gr.Image(type="pil", label="📷 Upload Image"),
18
+ outputs=gr.Image(type="pil", label="🎨 Background Removed"),
19
+ title="AI Background Remover",
20
+ description="Upload any image to automatically remove the background. Perfect for e-commerce, marketing, and content creation!",
21
+ examples=[
22
+ ["example1.jpg"], # We'll add these later
23
+ ["example2.jpg"],
24
+ ["example3.jpg"]
25
+ ]
26
+ )
27
+
28
+ if __name__ == "__main__":
29
+ demo.launch()