Mustafaansari commited on
Commit
acf2c81
·
verified ·
1 Parent(s): 0588b30

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from PIL import Image
3
+ from rembg import remove as rembg_remove
4
+ import io
5
+ import numpy as np
6
+
7
+ def remove_background(input_image):
8
+ img = Image.fromarray(input_image.astype('uint8'), 'RGB')
9
+ img = rembg_remove(img)
10
+ img_np = np.array(img)
11
+ return img_np
12
+
13
+ iface = gr.Interface(
14
+ fn=remove_background,
15
+ inputs="image",
16
+ outputs="image",
17
+ title="Background Removal",
18
+ description="Remove background from an image."
19
+ )
20
+
21
+ iface.launch(share=True)