Spaces:
Running on Zero
Download README.md from fedorajuandy/remove-background: direct link, hf CLI and curl.
- Browser
- Download file 2.31 kB
-
https://huggingface.co/spaces/fedorajuandy/remove-background/resolve/main/README.md
- Command line
-
hf download hf://spaces/fedorajuandy/remove-background/README.md
-
curl -L -o README.md https://huggingface.co/spaces/fedorajuandy/remove-background/resolve/main/README.md
A newer version of the Gradio SDK is available: 6.31.0
title: BiRefNet Background Remover
emoji: ✂️
colorFrom: indigo
colorTo: purple
sdk: gradio
sdk_version: 5.45.0
app_file: app.py
pinned: false
license: mit
short_description: Remove image backgrounds with BiRefNet.
BiRefNet Background Remover
A small Gradio app that creates transparent PNG cut-outs with BiRefNet-General, through rembg. It replaces the previous RMBG-2.0/Transformers implementation.
Run locally
Requires Python 3.10 or newer.
python -m venv .venv
# Windows PowerShell
.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python app.py
Open the local URL printed by Gradio. The first removal downloads the
birefnet-general ONNX weights and caches them; later requests reuse the
same in-process session. To choose a persistent cache location, set
REMBG_HOME before starting the app.
Deploy to Hugging Face Spaces
- Create a new Gradio Space, preferably with Python 3.10+.
- Push these files to the root of the Space:
app.py,remove_background.py,requirements.txt,README.md, andLICENSE. - Wait for the build to finish. No secrets or manual model download are required. The model downloads automatically on the first inference.
- For quicker or more reliable cold starts, use a persistent-storage upgrade
and set
REMBG_HOME=/data/rembgin the Space variables. This is optional; the default cache also works but is recreated after a free Space restarts.
The app queues one request at a time to keep memory usage safe. It supports Hugging Face ZeroGPU and requests a GPU only while removing a background; a CPU Space also works, albeit more slowly.
Licensing and attribution
This repository's code is MIT licensed. BiRefNet's upstream repository is
MIT licensed, and rembg is MIT licensed. The selected birefnet-general
model is the BiRefNet general-use ONNX model distributed by rembg; unlike
the prior BRIA RMBG-2.0 model, it is intended here to support commercial use.
Keep this attribution and independently review upstream model and dataset
terms for your specific deployment.
Links: BiRefNet · rembg model list