|
import gradio as gr |
|
from rembg import remove |
|
from PIL import Image |
|
|
|
|
|
def remove_background(input_image): |
|
output_image = remove(input_image) |
|
return output_image |
|
|
|
|
|
inputs = gr.inputs.Image() |
|
outputs = gr.outputs.Image(type="pil") |
|
interface = gr.Interface( |
|
fn=remove_background, |
|
inputs=inputs, |
|
outputs=outputs, |
|
title="Remove Background", |
|
description="This App removes the background from an image", |
|
examples=[ |
|
"examples/input/1.jpeg", |
|
"examples/input/2.jpeg", |
|
"examples/input/3.jpeg", |
|
], |
|
cache_examples=True, |
|
) |
|
interface.launch(enable_queue=True) |
|
|