diff --git a/.streamlit/config.toml b/.streamlit/config.toml index 658868f..408e980 100644 --- a/.streamlit/config.toml +++ b/.streamlit/config.toml @@ -1,2 +1,48 @@ +[global] +disableWatchdogWarning = false +showWarningOnDirectExecution = true +dataFrameSerialization = "arrow" + +[logger] +level = "info" +messageFormat = "%(asctime)s %(message)s" + +[client] +caching = true +displayEnabled = true +showErrorDetails = true + +[runner] +magicEnabled = true +installTracer = false +fixMatplotlib = true +postScriptGC = true +fastReruns = false + +[server] +folderWatchBlacklist = [] +fileWatcherType = "auto" +cookieSecret = "" +headless = false +runOnSave = false +port = 8501 +baseUrlPath = "" +enableCORS = true +enableXsrfProtection = true +maxUploadSize = 200 +maxMessageSize = 200 +enableWebsocketCompression = false + [browser] +serverAddress = "localhost" gatherUsageStats = false +serverPort = 8501 + +[mapbox] +token = "" + +[deprecation] +showfileUploaderEncoding = true +showPyplotGlobalUse = true + +[theme] diff --git a/configs/webui/webui_streamlit.yaml b/configs/webui/webui_streamlit.yaml index 55310b3..01e14df 100644 --- a/configs/webui/webui_streamlit.yaml +++ b/configs/webui/webui_streamlit.yaml @@ -3,6 +3,7 @@ # You may add overrides in a file named "userconfig_streamlit.yaml" in this folder, which can contain any subset # of the properties below. general: + streamlit_telemetry: False gpu: 0 outdir: outputs default_model: "Stable Diffusion v1.4" diff --git a/scripts/Settings.py b/scripts/Settings.py index 929062a..be7d984 100644 --- a/scripts/Settings.py +++ b/scripts/Settings.py @@ -149,6 +149,7 @@ def layout(): negative effect updating the preview image has on performance. Default: 10")) with col3: + st.title("Others") st.session_state["defaults"].general.use_sd_concepts_library = st.checkbox("Use the Concepts Library", value=st.session_state['defaults'].general.use_sd_concepts_library, help="Use the embeds Concepts Library, if checked, once the settings are saved an option will\ appear to specify the directory where the concepts are stored. Default: True)") @@ -183,6 +184,13 @@ def layout(): st.session_state["defaults"].general.no_verify_input = st.checkbox("Do not Verify Input", value=st.session_state['defaults'].general.no_verify_input, help="Do not verify input to check if it's too long. Default: False") + with col4: + st.title("Streamlit Config") + st.session_state["defaults"].general.streamlit_telemetry = st.checkbox("Enable Telemetry", value=st.session_state['defaults'].general.streamlit_telemetry, + help="Enables or Disables streamlit telemetry. Default: False") + + st.session_state["streamlit_config"]["browser"]["gatherUsageStats"] = st.session_state["defaults"].general.streamlit_telemetry + with txt2img_tab: st.title("Text To Image") @@ -221,12 +229,14 @@ def layout(): reset_button = st.form_submit_button("Reset") if save_button: - #userconfig_streamlit = OmegaConf.to_yaml(st.session_state.defaults) - #OmegaConf.save("configs/webui/userconfig_streamlit.yaml") - OmegaConf.save(config=st.session_state.defaults, f="configs/webui/userconfig_streamlit.yaml") loaded = OmegaConf.load("configs/webui/userconfig_streamlit.yaml") - assert st.session_state.defaults == loaded + assert st.session_state.defaults == loaded + + # + if (os.path.exists(".streamlit/config.toml")): + with open(".streamlit/config.toml", "w") as toml_file: + toml.dump(st.session_state["streamlit_config"], toml_file) if reset_button: st.session_state["defaults"] = OmegaConf.load("configs/webui/webui_streamlit.yaml") \ No newline at end of file diff --git a/scripts/sd_utils.py b/scripts/sd_utils.py index 2e097b4..fae58b9 100644 --- a/scripts/sd_utils.py +++ b/scripts/sd_utils.py @@ -14,7 +14,7 @@ import warnings import json import base64 -import os, sys, re, random, datetime, time, math, glob +import os, sys, re, random, datetime, time, math, glob, toml from PIL import Image, ImageFont, ImageDraw, ImageFilter from PIL.PngImagePlugin import PngInfo from scipy import integrate @@ -77,6 +77,13 @@ st.session_state["defaults"] = OmegaConf.load("configs/webui/webui_streamlit.yam if (os.path.exists("configs/webui/userconfig_streamlit.yaml")): user_defaults = OmegaConf.load("configs/webui/userconfig_streamlit.yaml") st.session_state["defaults"] = OmegaConf.merge(st.session_state["defaults"], user_defaults) +else: + OmegaConf.save(config=st.session_state.defaults, f="configs/webui/userconfig_streamlit.yaml") + loaded = OmegaConf.load("configs/webui/userconfig_streamlit.yaml") + assert st.session_state.defaults == loaded + +if (os.path.exists(".streamlit/config.toml")): + st.session_state["streamlit_config"] = toml.load(".streamlit/config.toml") # should and will be moved to a settings menu in the UI at some point diff --git a/scripts/webui_streamlit.py b/scripts/webui_streamlit.py index 86653e9..6992ba8 100644 --- a/scripts/webui_streamlit.py +++ b/scripts/webui_streamlit.py @@ -12,7 +12,7 @@ from streamlit_server_state import server_state, server_state_lock #other imports import warnings -import os +import os, toml import k_diffusion as K from omegaconf import OmegaConf @@ -29,6 +29,9 @@ else: loaded = OmegaConf.load("configs/webui/userconfig_streamlit.yaml") assert st.session_state.defaults == loaded +if (os.path.exists(".streamlit/config.toml")): + st.session_state["streamlit_config"] = toml.load(".streamlit/config.toml") + # end of imports #---------------------------------------------------------------------------------------------------------------