streamlit / app.py
SUNGJIN LEE
Initial commit
312b9eb
raw
history blame
1.62 kB
import streamlit as st
from streamlit.logger import get_logger
import streamlit_authenticator as stauth
import yaml
LOGGER = get_logger(__name__)
def run():
st.set_page_config(
page_title="SKT AI Fellowship Team ASAP",
page_icon="πŸ“‘",
layout="centered"
)
st.write("# SKT AI Fellowship Team ASAP πŸ‘‹")
def st_authenticator():
with open('config.yaml') as file:
config = yaml.load(file, Loader=stauth.SafeLoader)
authenticator = stauth.Authenticate(
config['credentials'],
config['cookie']['name'],
config['cookie']['key'],
config['cookie']['expiry_days'],
config['preauthorized']
)
return authenticator
if __name__ == "__main__":
run()
authenticator = st_authenticator()
if 'authentication_status' not in st.session_state:
st.session_state['authentication_status'] = None
st.session_state['username'] = None
name, authentication_status, username = authenticator.login("main", "Login")
if authentication_status:
st.session_state['authentication_status'] = True
st.session_state['username'] = username
st.success(f"{name}λ‹˜, ν™˜μ˜ν•©λ‹ˆλ‹€!")
authenticator.logout('Logout', 'main', key='unique_key')
elif authentication_status is False:
st.session_state['authentication_status'] = False
st.error('아이디/λΉ„λ°€λ²ˆν˜Έκ°€ 잘λͺ»λ˜μ—ˆμŠ΅λ‹ˆλ‹€.')
elif authentication_status is None:
st.session_state['authentication_status'] = None
st.warning('아이디와 λΉ„λ°€λ²ˆν˜Έλ₯Ό μž…λ ₯ν•΄μ£Όμ„Έμš”.')