RemBG_API / app.py
VINU NAYAK
Create app.py
bb1e2a4 verified
Raw
History Blame
559 Bytes
import gradio as gr
from rembg import remove
from PIL import Image
import io
def remove_background(input_image):
if isinstance(input_image, str):
input_image = Image.open(input_image)
output_image = remove(input_image)
return output_image
demo = gr.Interface(
fn=remove_background,
inputs=gr.Image(type="pil"),
outputs=gr.Image(type="pil"),
title="Background Remover",
description="Upload an image to remove its background",
examples=[],
theme=gr.themes.Soft()
)
if __name__ == "__main__":
demo.launch()