import streamlit as st import os if "logged_in" not in st.session_state: st.session_state.logged_in = False def login(): st.write("# SKT AI Fellowship Team ASAP ๐Ÿ‘‹") with st.form("Login"): st.write("### Login") username = st.text_input("Username", type="default") password = st.text_input("Password", type="password") login = st.form_submit_button("Login") if login: # if username== st.secrets["auth"]["username"] and password == st.secrets["auth"]["password"]: if username== os.getenv("username") and password == os.getenv("password"): st.session_state.logged_in = True st.rerun() else: st.error("Username ๋˜๋Š” Password๊ฐ€ ์ผ์น˜ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.") def logout(): st.session_state.logged_in = False st.rerun() login_page = st.Page(login, title="Log in", icon=":material/login:") logout_page = st.Page(logout, title="Log out", icon=":material/logout:") Home = st.Page( "Pages/Home.py", title="Home", icon=":material/home:" ) About = st.Page( "Pages/About.py", title="About", icon=":material/info:" ) Data = st.Page( "Pages/Data.py", title="Data", icon=":material/data_usage:" ) Algorithm = st.Page( "Pages/Algorithm.py", title="Algorithm", icon=":material/insights:" ) Dashboard = st.Page( "Pages/Dashboard.py", title="Dashboard", icon=":material/dashboard:" ) Recommendation_System = st.Page( "Pages/Recommendation System.py", title="Recommendation System", icon=":material/assistant_photo:", ) if st.session_state.logged_in: pg = st.navigation( { "": [Home, About], # "Development": [Data, Algorithm], "System" : [Dashboard, Recommendation_System], "Account": [logout_page] } ) else: pg = st.navigation([login_page]) pg.run()