Made the defaults settings from the config file be stored inside st.session_state to avoid loading it multiple times when calling the "sd_utils.py" file from other modules.

This commit is contained in:
ZeroCool940711 2022-09-14 03:32:32 -07:00
parent ef6b39ab6d
commit 1afc89e0d1
2 changed files with 1320 additions and 4 deletions

File diff suppressed because it is too large Load Diff

View File

@ -57,10 +57,14 @@ except:
# remove some annoying deprecation warnings that show every now and then.
warnings.filterwarnings("ignore", category=DeprecationWarning)
defaults = OmegaConf.load("configs/webui/webui_streamlit.yaml")
if (os.path.exists("configs/webui/userconfig_streamlit.yaml")):
user_defaults = OmegaConf.load("configs/webui/userconfig_streamlit.yaml");
defaults = OmegaConf.merge(defaults, user_defaults)
if "defaults" not in st.session_state:
st.session_state["defaults"] = OmegaConf.load(os.path.join("configs","webui", "webui_streamlit.yaml"))
if (os.path.exists(os.path.join("configs","webui", "userconfig_streamlit.yaml"))):
user_defaults = OmegaConf.load(os.path.join("configs","webui", "userconfig_streamlit.yaml"));
st.session_state["defaults"] = OmegaConf.merge(st.session_state["defaults"], user_defaults)
defaults = st.session_state["defaults"]
# this is a fix for Windows users. Without it, javascript files will be served with text/html content-type and the bowser will not show any UI
mimetypes.init()