mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg.git
synced 2026-01-26 11:19:56 +00:00
Changed the default download location of u2net models to <stable-diffusion-webui>/models/u2net
This commit is contained in:
@@ -2,7 +2,9 @@ from modules import scripts_postprocessing
|
||||
import gradio as gr
|
||||
|
||||
from modules.ui_components import FormRow
|
||||
from modules.paths_internal import models_path
|
||||
import rembg
|
||||
import os
|
||||
|
||||
models = [
|
||||
"None",
|
||||
@@ -50,6 +52,9 @@ class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing):
|
||||
if not model or model == "None":
|
||||
return
|
||||
|
||||
if "U2NET_HOME" not in os.environ:
|
||||
os.environ["U2NET_HOME"] = os.path.join(models_path, "u2net")
|
||||
|
||||
pp.image = rembg.remove(
|
||||
pp.image,
|
||||
session=rembg.new_session(model),
|
||||
|
||||
Reference in New Issue
Block a user