mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-01-07 01:32:49 -08:00
Merge pull request #10557 from akx/dedupe-webui-boot
Refactor & deduplicate web UI boot code
This commit is contained in:
commit
cc6c0fc70a
5 changed files with 167 additions and 136 deletions
|
|
@ -14,6 +14,11 @@ def register_extra_network(extra_network):
|
|||
extra_network_registry[extra_network.name] = extra_network
|
||||
|
||||
|
||||
def register_default_extra_networks():
|
||||
from modules.extra_networks_hypernet import ExtraNetworkHypernet
|
||||
register_extra_network(ExtraNetworkHypernet())
|
||||
|
||||
|
||||
class ExtraNetworkParams:
|
||||
def __init__(self, items=None):
|
||||
self.items = items or []
|
||||
|
|
|
|||
|
|
@ -271,6 +271,12 @@ def load_scripts():
|
|||
sys.path = syspath
|
||||
current_basedir = paths.script_path
|
||||
|
||||
global scripts_txt2img, scripts_img2img, scripts_postproc
|
||||
|
||||
scripts_txt2img = ScriptRunner()
|
||||
scripts_img2img = ScriptRunner()
|
||||
scripts_postproc = scripts_postprocessing.ScriptPostprocessingRunner()
|
||||
|
||||
|
||||
def wrap_call(func, filename, funcname, *args, default=None, **kwargs):
|
||||
try:
|
||||
|
|
@ -527,9 +533,9 @@ class ScriptRunner:
|
|||
self.scripts[si].args_to = args_to
|
||||
|
||||
|
||||
scripts_txt2img = ScriptRunner()
|
||||
scripts_img2img = ScriptRunner()
|
||||
scripts_postproc = scripts_postprocessing.ScriptPostprocessingRunner()
|
||||
scripts_txt2img: ScriptRunner = None
|
||||
scripts_img2img: ScriptRunner = None
|
||||
scripts_postproc: scripts_postprocessing.ScriptPostprocessingRunner = None
|
||||
scripts_current: ScriptRunner = None
|
||||
|
||||
|
||||
|
|
@ -539,14 +545,7 @@ def reload_script_body_only():
|
|||
scripts_img2img.reload_sources(cache)
|
||||
|
||||
|
||||
def reload_scripts():
|
||||
global scripts_txt2img, scripts_img2img, scripts_postproc
|
||||
|
||||
load_scripts()
|
||||
|
||||
scripts_txt2img = ScriptRunner()
|
||||
scripts_img2img = ScriptRunner()
|
||||
scripts_postproc = scripts_postprocessing.ScriptPostprocessingRunner()
|
||||
reload_scripts = load_scripts # compatibility alias
|
||||
|
||||
|
||||
def add_classes_to_gradio_component(comp):
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ def setup_model():
|
|||
if not os.path.exists(model_path):
|
||||
os.makedirs(model_path)
|
||||
|
||||
list_models()
|
||||
enable_midas_autodownload()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -232,10 +232,19 @@ class ExtraNetworksPage:
|
|||
return None
|
||||
|
||||
|
||||
def intialize():
|
||||
def initialize():
|
||||
extra_pages.clear()
|
||||
|
||||
|
||||
def register_default_pages():
|
||||
from modules.ui_extra_networks_textual_inversion import ExtraNetworksPageTextualInversion
|
||||
from modules.ui_extra_networks_hypernets import ExtraNetworksPageHypernetworks
|
||||
from modules.ui_extra_networks_checkpoints import ExtraNetworksPageCheckpoints
|
||||
register_page(ExtraNetworksPageTextualInversion())
|
||||
register_page(ExtraNetworksPageHypernetworks())
|
||||
register_page(ExtraNetworksPageCheckpoints())
|
||||
|
||||
|
||||
class ExtraNetworksUi:
|
||||
def __init__(self):
|
||||
self.pages = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue