Spaces:
Runtime error
Runtime error
app is ready
Browse files- app.py +22 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from rembg import remove
|
3 |
+
from PIL import Image
|
4 |
+
|
5 |
+
def remove_background(input_image):
|
6 |
+
|
7 |
+
input = Image.open(input_image) # load image
|
8 |
+
output = remove(input) # remove background
|
9 |
+
return output
|
10 |
+
|
11 |
+
|
12 |
+
input_image = gr.inputs.Image(type="filepath", label="Input Image")
|
13 |
+
output_image = gr.inputs.Image(type="filepath", label="Output Image")
|
14 |
+
# Create a Gradio interface
|
15 |
+
iface = gr.Interface(remove_background,
|
16 |
+
inputs=input_image,
|
17 |
+
outputs=output_image,
|
18 |
+
title='Image Background Remover',
|
19 |
+
description='Upload an image and it will remove.')
|
20 |
+
|
21 |
+
# Launch the interface
|
22 |
+
iface.launch(share='True')
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
gradio==3.19.1
|
2 |
+
Pillow==9.4.0
|
3 |
+
rembg==2.0.30
|