RMBG / app.py
prithivMLmods's picture
Update app.py
a958432 verified
raw
history blame
814 Bytes
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)