fariyan commited on
Commit
92940db
1 Parent(s): eb63989

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from rembg import remove
3
+ from PIL import Image
4
+ import io
5
+
6
+ def remove_background(image):
7
+ input_data = image.read()
8
+ output_data = remove(input_data)
9
+ output_image = Image.open(io.BytesIO(output_data)).convert("RGBA")
10
+ return output_image
11
+
12
+ image_input = gr.inputs.Image()
13
+ image_output = gr.outputs.Image()
14
+
15
+ title = "Remove Background from Image"
16
+ description = "Upload an image and remove its background using the rembg library."
17
+
18
+ gr.Interface(fn=remove_background, inputs=image_input, outputs=image_output, title=title, description=description).launch()