2024-01-20 10:21:36 -07:00
|
|
|
import os
|
2022-09-29 16:46:23 -06:00
|
|
|
import sys
|
|
|
|
|
2022-09-03 03:08:45 -06:00
|
|
|
import gradio as gr
|
|
|
|
|
2023-08-22 10:05:03 -06:00
|
|
|
from modules import shared_cmd_options, shared_gradio_themes, options, shared_items, sd_models_types
|
2023-05-10 00:02:23 -06:00
|
|
|
from modules.paths_internal import models_path, script_path, data_path, sd_configs_path, sd_default_config, sd_model_file, default_sd_model_file, extensions_dir, extensions_builtin_dir # noqa: F401
|
2023-08-09 01:25:35 -06:00
|
|
|
from modules import util
|
2024-03-10 21:40:15 -06:00
|
|
|
from typing import TYPE_CHECKING
|
2022-11-27 01:52:53 -07:00
|
|
|
|
2024-03-10 21:40:15 -06:00
|
|
|
if TYPE_CHECKING:
|
2024-03-10 19:15:09 -06:00
|
|
|
from modules import shared_state, styles, interrogate, shared_total_tqdm, memmon
|
|
|
|
|
2023-08-09 01:25:35 -06:00
|
|
|
cmd_opts = shared_cmd_options.cmd_opts
|
|
|
|
parser = shared_cmd_options.parser
|
2022-09-10 23:11:27 -06:00
|
|
|
|
2023-08-21 06:07:10 -06:00
|
|
|
batch_cond_uncond = True # old field, unused now in favor of shared.opts.batch_cond_uncond
|
2023-08-22 09:49:08 -06:00
|
|
|
parallel_processing_allowed = True
|
2024-01-20 10:21:36 -07:00
|
|
|
styles_filename = cmd_opts.styles_file = cmd_opts.styles_file if len(cmd_opts.styles_file) > 0 else [os.path.join(data_path, 'styles.csv')]
|
2023-08-09 01:25:35 -06:00
|
|
|
config_filename = cmd_opts.ui_settings_file
|
2022-09-24 07:29:20 -06:00
|
|
|
hide_dirs = {"visible": not cmd_opts.hide_ui_dir_config}
|
2023-05-17 11:22:38 -06:00
|
|
|
|
2024-03-10 19:15:09 -06:00
|
|
|
demo: gr.Blocks = None
|
2023-01-29 14:25:30 -07:00
|
|
|
|
2024-03-10 19:15:09 -06:00
|
|
|
device: str = None
|
2023-01-29 14:25:30 -07:00
|
|
|
|
2024-03-10 19:15:09 -06:00
|
|
|
weight_load_location: str = None
|
2022-09-03 03:08:45 -06:00
|
|
|
|
2023-08-09 01:25:35 -06:00
|
|
|
xformers_available = False
|
2023-05-02 00:08:00 -06:00
|
|
|
|
2023-08-09 01:25:35 -06:00
|
|
|
hypernetworks = {}
|
2023-05-02 00:08:00 -06:00
|
|
|
|
2023-08-09 01:25:35 -06:00
|
|
|
loaded_hypernetworks = []
|
2023-05-02 00:08:00 -06:00
|
|
|
|
2024-03-10 19:15:09 -06:00
|
|
|
state: 'shared_state.State' = None
|
2023-05-02 00:08:00 -06:00
|
|
|
|
2024-03-10 19:15:09 -06:00
|
|
|
prompt_styles: 'styles.StyleDatabase' = None
|
2023-05-02 00:08:00 -06:00
|
|
|
|
2024-03-10 19:15:09 -06:00
|
|
|
interrogator: 'interrogate.InterrogateModels' = None
|
2023-05-02 00:08:00 -06:00
|
|
|
|
2023-08-09 01:25:35 -06:00
|
|
|
face_restorers = []
|
2023-05-02 00:08:00 -06:00
|
|
|
|
2024-03-10 19:15:09 -06:00
|
|
|
options_templates: dict = None
|
|
|
|
opts: options.Options = None
|
|
|
|
restricted_opts: set[str] = None
|
2023-05-02 00:08:00 -06:00
|
|
|
|
2023-08-22 10:05:03 -06:00
|
|
|
sd_model: sd_models_types.WebuiSdModel = None
|
2023-05-02 00:08:00 -06:00
|
|
|
|
2024-03-10 19:15:09 -06:00
|
|
|
settings_components: dict = None
|
2024-06-20 19:52:02 -06:00
|
|
|
"""assigned from ui.py, a mapping on setting names to gradio components responsible for those settings"""
|
2023-01-29 14:25:30 -07:00
|
|
|
|
2023-08-09 01:25:35 -06:00
|
|
|
tab_names = []
|
|
|
|
|
2023-01-02 09:42:10 -07:00
|
|
|
latent_upscale_default_mode = "Latent"
|
|
|
|
latent_upscale_modes = {
|
2023-01-04 03:12:06 -07:00
|
|
|
"Latent": {"mode": "bilinear", "antialias": False},
|
|
|
|
"Latent (antialiased)": {"mode": "bilinear", "antialias": True},
|
|
|
|
"Latent (bicubic)": {"mode": "bicubic", "antialias": False},
|
2023-01-04 03:36:18 -07:00
|
|
|
"Latent (bicubic antialiased)": {"mode": "bicubic", "antialias": True},
|
2023-01-04 03:12:06 -07:00
|
|
|
"Latent (nearest)": {"mode": "nearest", "antialias": False},
|
2023-01-05 08:17:39 -07:00
|
|
|
"Latent (nearest-exact)": {"mode": "nearest-exact", "antialias": False},
|
2023-01-02 09:42:10 -07:00
|
|
|
}
|
|
|
|
|
2022-09-04 09:54:12 -06:00
|
|
|
sd_upscalers = []
|
2022-09-03 03:08:45 -06:00
|
|
|
|
2022-10-16 09:53:56 -06:00
|
|
|
clip_model = None
|
2022-09-05 14:08:06 -06:00
|
|
|
|
2022-09-08 07:37:13 -06:00
|
|
|
progress_print_out = sys.stdout
|
2022-09-05 14:08:06 -06:00
|
|
|
|
2023-03-25 14:11:41 -06:00
|
|
|
gradio_theme = gr.themes.Base()
|
|
|
|
|
2024-03-10 19:15:09 -06:00
|
|
|
total_tqdm: 'shared_total_tqdm.TotalTQDM' = None
|
2023-03-25 14:11:41 -06:00
|
|
|
|
2024-03-10 19:15:09 -06:00
|
|
|
mem_mon: 'memmon.MemUsageMonitor' = None
|
2023-05-17 12:45:26 -06:00
|
|
|
|
2023-08-09 01:25:35 -06:00
|
|
|
options_section = options.options_section
|
|
|
|
OptionInfo = options.OptionInfo
|
|
|
|
OptionHTML = options.OptionHTML
|
2023-07-31 15:24:48 -06:00
|
|
|
|
2023-08-09 01:25:35 -06:00
|
|
|
natural_sort_key = util.natural_sort_key
|
|
|
|
listfiles = util.listfiles
|
|
|
|
html_path = util.html_path
|
|
|
|
html = util.html
|
|
|
|
walk_files = util.walk_files
|
|
|
|
ldm_print = util.ldm_print
|
2023-07-31 15:24:48 -06:00
|
|
|
|
2023-08-09 01:25:35 -06:00
|
|
|
reload_gradio_theme = shared_gradio_themes.reload_gradio_theme
|
2023-07-31 15:24:48 -06:00
|
|
|
|
2023-08-09 01:25:35 -06:00
|
|
|
list_checkpoint_tiles = shared_items.list_checkpoint_tiles
|
|
|
|
refresh_checkpoints = shared_items.refresh_checkpoints
|
|
|
|
list_samplers = shared_items.list_samplers
|
|
|
|
reload_hypernetworks = shared_items.reload_hypernetworks
|
2024-04-05 23:53:21 -06:00
|
|
|
|
|
|
|
hf_endpoint = os.getenv('HF_ENDPOINT', 'https://huggingface.co')
|