Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from PIL import Image | |
| from rembg import remove as rembg_remove | |
| import numpy as np | |
| def remove_background(input_image): | |
| try: | |
| img = Image.fromarray(input_image.astype('uint8'), 'RGB') | |
| img = rembg_remove(img) | |
| img_np = np.array(img) | |
| return img_np | |
| except Exception as e: | |
| return f"Error: {e}" | |
| iface = gr.Interface( | |
| fn=remove_background, | |
| inputs="image", | |
| outputs="image", | |
| title="Background Removal of images", | |
| description="Remove background from an image." | |
| ) | |
| iface.launch(share=True) | |