Added option for admins to hide the server and browser settings form the Settings page. (#1618)

This commit is contained in:
Alejandro Gil 2022-10-28 23:49:28 -07:00 committed by GitHub
commit 1edaccfeb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 42 deletions

View File

@ -65,6 +65,10 @@ general:
update_preview: True
update_preview_frequency: 10
admin:
hide_server_setting: False
hide_browser_setting: False
debug:
enable_hydralit: False

View File

@ -213,6 +213,8 @@ def layout():
help="Defaut theme to use as base for streamlit. Default: dark")
st.session_state["streamlit_config"]["theme"]["base"] = st.session_state["defaults"].general.default_theme
if not st.session_state['defaults'].admin.hide_server_setting:
with st.expander("Server", True):
st.session_state["streamlit_config"]['server']['headless'] = st.checkbox("Run Headless", help="If false, will attempt to open a browser window on start. \
@ -246,6 +248,7 @@ def layout():
st.session_state["streamlit_config"]['server']['enableWebsocketCompression'] = st.checkbox("Enable Websocket Compression",
value=st.session_state["streamlit_config"]['server']['enableWebsocketCompression'],
help=" Enables support for websocket compression. Default: false")
if not st.session_state['defaults'].admin.hide_browser_setting:
with st.expander("Browser", expanded=True):
st.session_state["streamlit_config"]['browser']['serverAddress'] = st.text_input("Server Address",
value=st.session_state["streamlit_config"]['browser']['serverAddress'],
@ -264,9 +267,6 @@ def layout():
- Show the URL on the terminal - Open the browser \
Default: whatever value is set in server.port.")
with col5:
st.title("Huggingface")
st.session_state["defaults"].general.huggingface_token = st.text_input("Huggingface Token", value=st.session_state['defaults'].general.huggingface_token, type="password",