File size: 542 Bytes
a3f48ee
caaae3e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a3f48ee
 
 
31a3de4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from rembg import remove
from PIL import Image
import io

def fast_process(input_image):
    if input_image is None:
        return None
    # Rembg handles the ONNX optimization internally
    output = remove(input_image)
    return output

demo = gr.Interface(
    fn=fast_process,
    inputs=gr.Image(type="pil"),
    outputs=gr.Image(type="pil"),
    title="Ultra-Fast CPU Background Remover",
    description="Using rembg + ONNX for 1-2 second processing on most CPUs."
)

if __name__ == "__main__":
    demo.launch()