Spaces:
Running
Running
File size: 882 Bytes
727f111 db67721 727f111 ee81506 727f111 db67721 ee81506 db67721 727f111 ee81506 db67721 ee81506 db67721 ee81506 727f111 ee81506 |
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 |
import gradio as gr
from transformers import pipeline
from PIL import Image
def remove_background(image):
pipe = pipeline('image-segmentation', model='briaai/RMBG-1.4', trust_remote_code=True)
pillow_mask = pipe(image, return_mask=True)
pillow_image = pipe(image)
return pillow_image
# Create interface
app = gr.Interface(
fn=remove_background,
inputs=gr.Image(type='pil'),
outputs=gr.Image(type='pil', format='png'),
title='Remove image background',
description='Remove backgrounds from photos automatically in seconds - 100% free, no watermarks, works on any device!'
)
# CSS to hide footer and adjust margins
app.css = """
footer {visibility: hidden !important;}
.gr-footer {display: none !important;}
.gradio-container {margin-bottom: 0 !important;}
"""
# Launch with minimal options
if __name__ == "__main__":
app.launch(share=True) |