File size: 409 Bytes
9fd2345
 
2be961e
9fd2345
 
 
272920e
9fd2345
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
from rembg import remove
import subprocess


def remove_background(input_img):
    subprocess.call(['sh', 'copylib.sh']) 
    output_path = f'output.png + {id(input_img)}'
    output = remove(input_img)
    output.save(output_path)
    return output_path

# type = pil passes the image as a Pillow object
demo = gr.Interface(remove_background, gr.Image(type="pil"), "image")
demo.launch()