import cv2 import gradio as gr import os import functools from PIL import Image from rembg import remove from io import BytesIO import numpy as np import torch from torch.autograd import Variable from torchvision import transforms import torch.nn.functional as F import gdown import matplotlib.pyplot as plt import warnings warnings.filterwarnings("ignore") import requests @functools.lru_cache() def get_url_im(t): user_agent = {'User-agent': 'gradio-app'} response = requests.get(t, headers=user_agent) return (BytesIO(response.content)) def inference(image): im_path = get_url_im(image) im = Image.open((im_path)) return im, im , im title = "Bg remover for sarvm catalog" description = "Bg remover for sarvm catalog" article = "
visitor badge
" interface = gr.Interface( fn=inference, inputs=gr.Textbox(label="Text or Image URL", interactive=True), outputs=["image", "image", "image"], title=title , description=description, article=article, allow_flagging='never', cache_examples=False, ).queue().launch(show_error=True, share = True)