import logging import gradio as gr from rembg import new_session from cutter import remove, make_label from utils import * remove_bg_models = { "U2NET": "u2net", "U2NET Human Seg": "u2net_human_seg", "U2NET Cloth Seg": "u2net_cloth_seg" } default_model = "U2NET" def predict(image): session = new_session(remove_bg_models[default_model]) smoot = False matting = (0, 0, 0) # Valores predeterminados para matting bg_color = (0, 0, 0) # Color de fondo predeterminado (negro) try: result = remove(session, image, smoot, matting, bg_color) return result except ValueError as err: logging.error(err) return None with gr.Blocks(title="Remove background") as app: gr.HTML("