File size: 453 Bytes
95a864c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54acd01
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from transformers import pipeline
import gradio as gr

pipe = pipeline(
    "image-segmentation",
    model="briaai/RMBG-1.4",
    revision="refs/pr/9",
    trust_remote_code=True,
)


def predict(image_path):
    pipe(image_path, out_name="myout.png")
    return "myout.png"


gr.Interface(
    predict,
    gr.Image(type="filepath"),
    "image",
    examples=[["./lain with background.jpg"], ["./gigachad.webp"]],
    cache_examples=True,
).launch()