feat(rembg): switch background removal to bria-rmbg model
Replace default u2net with bria-rmbg-2.0 for better quality. BackgroundRemover now accepts model_name param (defaults to 'bria-rmbg'). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -17,8 +17,8 @@ from rembg import remove, new_session
|
||||
|
||||
|
||||
class BackgroundRemover():
|
||||
def __init__(self):
|
||||
self.session = new_session()
|
||||
def __init__(self, model_name: str = "bria-rmbg"):
|
||||
self.session = new_session(model_name)
|
||||
|
||||
def __call__(self, image: Image.Image):
|
||||
output = remove(image, session=self.session, bgcolor=[255, 255, 255, 0])
|
||||
|
||||
Reference in New Issue
Block a user