Added option to enable or disable the streamlit data usage gathering or telemetry.

This commit is contained in:
ZeroCool940711 2022-09-26 01:12:06 -07:00
parent 3bf7968f3b
commit c37a92c39f
5 changed files with 73 additions and 6 deletions

View File

@ -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]

View File

@ -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"

View File

@ -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")

View File

@ -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

View File

@ -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
#---------------------------------------------------------------------------------------------------------------