Closed ihpolash closed 10 months ago
Hi @ihpolash can you please share your code?
@mkhorasani Here is the code. I've implemented under pages/train.py
import streamlit as st
import streamlit_authenticator as stauth
import yaml
from yaml.loader import SafeLoader
# hashed_passwords = stauth.Hasher(['abc']).generate()
st.set_page_config(initial_sidebar_state="collapsed")
with open('config.yaml') as file:
config = yaml.load(file, Loader=SafeLoader)
st.markdown(
"""
<style>
[data-testid="collapsedControl"] {
display: none
}
</style>
""",
unsafe_allow_html=True,
)
hide_menu = """
<style>
#MainMenu {
visibility:hidden;
}
footer{
visibility:hidden;
}
</style>
"""
def main():
authenticator = stauth.Authenticate(
config['credentials'],
config['cookie']['name'],
config['cookie']['key'],
config['cookie']['expiry_days'],
config['preauthorized']
)
name, authentication_status, username = authenticator.login('Login', 'main')
st.markdown(hide_menu, unsafe_allow_html=True)
if authentication_status:
authenticator.logout('Logout', 'main', key='unique_key')
# st.markdown('<h1 style="color:black;">Model Training</h1>', unsafe_allow_html=True)
# st.markdown('<h2 style="color:gray;">Upload dataset</h2>', unsafe_allow_html=True)
# set_png_as_page_bg('bg.jpg')
upload= st.file_uploader('Insert zip file for training', type=['zip'])
extract_dir = 'data'
if upload is not None:
# Unzip the file
unzip_file(upload, extract_dir)
hist = train_test_data_gen()
fig, ax = plt.subplots()
ax.plot(hist.history['accuracy'])
ax.plot(hist.history['val_accuracy'])
ax.set_title('model accuracy')
ax.set_ylabel('accuracy')
ax.set_xlabel('epoch')
# ax.set_legend(['train', 'val'], loc='upper left')
st.pyplot(fig)
K.clear_session()
elif authentication_status is False:
st.error('Username/password is incorrect')
# elif authentication_status is None:
# st.warning('Please enter your username and password')
if __name__ == "__main__":
main()
any follow up on this? I think the cookie manager is not updated to account for some deprecations in Streamlit cache system.
the same for me
any update from the developer?
Dear all I have made the following PR to the developer to update the library. Please stay tuned.
I'm still having this issue with streamlit-authenticator==0.2.2
I'm trying to implement login option on my app. But getting this error & can't login to the main body.
Please help.