Spaces:
Runtime error
Runtime error
File size: 699 Bytes
e20b9fd 2adeb8a b2c440a dcdfe16 e20b9fd 8180ff8 e20b9fd 053dcb6 8180ff8 b2c440a 115f928 317e696 b2c440a 8180ff8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import os
import gradio as gr
from rembg import remove
# Set environment variable for Numba
os.environ['NUMBA_CACHE_DIR'] = '/tmp/numba_cache'
def remove_background(input_image):
try:
output = remove(input_image)
return output
except Exception as e:
print(f"Error processing image: {str(e)}")
return None
interface = gr.Interface(
fn=remove_background,
inputs=gr.Image(type="filepath", label="Input Image"),
outputs=gr.Image(type="filepath", label="Output Image"),
title="Background Remover",
description="Upload an image to remove the background",
allow_flagging="never"
)
interface.launch(server_name="0.0.0.0", server_port=7860) |