Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,37 +1,36 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from rembg import remove
|
3 |
-
|
4 |
-
# Custom CSS for styling
|
5 |
-
css = '''
|
6 |
-
.gradio-container { max-width: 1200px !important; }
|
7 |
-
h1 { text-align: center; }
|
8 |
-
footer { visibility: hidden; }
|
9 |
-
'''
|
10 |
-
|
11 |
-
# Function to remove background
|
12 |
-
def segment(image):
|
13 |
-
"""
|
14 |
-
Removes the background from the input image.
|
15 |
-
|
16 |
-
Args:
|
17 |
-
image: An image file uploaded by the user.
|
18 |
-
|
19 |
-
Returns:
|
20 |
-
The image with its background removed.
|
21 |
-
"""
|
22 |
-
return remove(image)
|
23 |
-
|
24 |
-
# Gradio Interface
|
25 |
-
demo = gr.Interface(
|
26 |
-
fn=segment,
|
27 |
-
inputs=gr.Image(label="Input Image", interactive=True),
|
28 |
-
outputs=gr.Image(label="Result Image"),
|
29 |
-
title="RMBG",
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
demo.launch(show_api=False)
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from rembg import remove
|
3 |
+
|
4 |
+
# Custom CSS for styling
|
5 |
+
css = '''
|
6 |
+
.gradio-container { max-width: 1200px !important; }
|
7 |
+
h1 { text-align: center; }
|
8 |
+
footer { visibility: hidden; }
|
9 |
+
'''
|
10 |
+
|
11 |
+
# Function to remove background
|
12 |
+
def segment(image):
|
13 |
+
"""
|
14 |
+
Removes the background from the input image.
|
15 |
+
|
16 |
+
Args:
|
17 |
+
image: An image file uploaded by the user.
|
18 |
+
|
19 |
+
Returns:
|
20 |
+
The image with its background removed.
|
21 |
+
"""
|
22 |
+
return remove(image)
|
23 |
+
|
24 |
+
# Gradio Interface
|
25 |
+
demo = gr.Interface(
|
26 |
+
fn=segment,
|
27 |
+
inputs=gr.Image(label="Input Image", interactive=True),
|
28 |
+
outputs=gr.Image(label="Result Image"),
|
29 |
+
title="RMBG",
|
30 |
+
css=css,
|
31 |
+
theme="bethecloud/storj_theme" # Ensure this theme is available or remove it
|
32 |
+
)
|
33 |
+
|
34 |
+
# Launch the app
|
35 |
+
if __name__ == "__main__":
|
36 |
+
demo.launch(show_api=False)
|
|