prithivMLmods commited on
Commit
a958432
·
verified ·
1 Parent(s): 18317a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -37
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
- description="Upload an image to remove its background automatically!",
31
- css=css,
32
- theme="bethecloud/storj_theme" # Ensure this theme is available or remove it
33
- )
34
-
35
- # Launch the app
36
- if __name__ == "__main__":
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)