BEN2 Background Remover is an AI-powered tool designed to remove backgrounds from images with high precision. It utilizes the BEN_Base model for processing images and is implemented using Gradio for an interactive web-based interface.
- Removes backgrounds from images efficiently
- Supports multiple image formats (JPG, PNG, WEBP)
- Processes images up to 4096x4096 pixels
- Simple and intuitive UI using Gradio
- Runs on both CPU and GPU
Ensure you have the following installed:
- Python 3.8+
- Pip
- PyTorch (with CUDA if using GPU)
pip install -r requirements.txtpython app.pyThis will start a local Gradio server, accessible at http://127.0.0.1:7860/.
- Upload an image using the input area.
- Click the "Remove Background" button.
- Wait for the processing to complete.
- Download the result with a transparent background.
The BEN_Base model is loaded from Hugging Face:
- Repository: PramaLLC/BEN2
- Model File:
BEN2_Base.pth
If the model file is not present, it will be automatically downloaded.
To ensure reproducibility, random seeds are set for:
- Python’s
randommodule - NumPy
- PyTorch (CPU & CUDA)
- Load the image and convert it to RGB.
- Pass the image through the BEN_Base model for inference.
- Save and return the processed transparent image.
The interface is built with Gradio using a custom modern theme:
- Primary Hue: Indigo
- Secondary Hue: Slate
- Font: Inter, IBM Plex Mono
Contributions are welcome! Feel free to open issues or submit pull requests.
This project is licensed under the MIT License.