mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg.git
synced 2026-04-30 19:21:23 +00:00
Merge pull request #28 from h3rmit-git/master
Changed the default download location of u2net models
This commit is contained in:
@@ -2,7 +2,9 @@ from modules import scripts_postprocessing, ui_components
|
|||||||
import gradio as gr
|
import gradio as gr
|
||||||
|
|
||||||
from modules.ui_components import FormRow
|
from modules.ui_components import FormRow
|
||||||
|
from modules.paths_internal import models_path
|
||||||
import rembg
|
import rembg
|
||||||
|
import os
|
||||||
|
|
||||||
models = [
|
models = [
|
||||||
"None",
|
"None",
|
||||||
@@ -55,6 +57,9 @@ class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing):
|
|||||||
if not model or model == "None":
|
if not model or model == "None":
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if "U2NET_HOME" not in os.environ:
|
||||||
|
os.environ["U2NET_HOME"] = os.path.join(models_path, "u2net")
|
||||||
|
|
||||||
pp.image = rembg.remove(
|
pp.image = rembg.remove(
|
||||||
pp.image,
|
pp.image,
|
||||||
session=rembg.new_session(model),
|
session=rembg.new_session(model),
|
||||||
|
|||||||
Reference in New Issue
Block a user