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