5. Use Screen
Streamlit will close the session as soon as you exit SSH session. To make it persistence, we need to use screen tool. Once you create session in screen, you can close the terminal and connect the server using new terminal. It will create persistence session.
# screen -S streamlit
Deploy Streamlit app:
# streamlit run main.py --server.port 80
Now close the terminal and connect with server in new terminal and run following command list the screen session.
# screen -list
We have successfully completed with the installation process and also we have deployed our first app.
In this article, we have seen how to install Streamlit on Ubuntu 20.04.
https://www.hostnextra.com/kb/install-streamlit-on-ubuntu-20-04/
https://bio-info.tistory.com/42
https://zzsza.github.io/mlops/2021/02/07/python-streamlit-dashboard/
https://lucaseo.github.io/posts/2021-10-09-intro-streamlit-sharing/
https://towardsdatascience.com/how-to-add-a-user-authentication-service-in-streamlit-a8b93bf02031
https://medium.com/artificialis/how-to-add-user-authentication-on-your-streamlit-app-c7f50c085b9f
import pandas as pd
import streamlit as st
import streamlit_authenticator as stauth
names = ['Lewandowski','Hanafi Harron']
usernames = ['lewan','hanafi']
passwords = ['mth107','mth108']
hashed_passwords = stauth.hasher(passwords).generate()
authenticator = stauth.authenticate(names,usernames,hashed_passwords,
'AdLeS_cookie','AdLeS_key',cookie_expiry_days=30)
name, authentication_status = authenticator.login('Login','main')
if authentication_status:
st.title('Welcome *%s* to Pakistan' % (name))
st.write("Our first Streamlit App")
st.write(
pd.DataFrame({
'A': [1, 2, 3, 4],
'B': [5, 6, 7, 8]
})
)
elif authentication_status == False:
st.error('Username/password is incorrect')
elif authentication_status == None:
st.warning('Please enter your username and password')
https://docs.streamlit.io/knowledge-base/deploy/deploy-streamlit-heroku-aws-google-cloud
https://www.youtube.com/watch?v=J9wy6yPJRiQ
'Python > Streamlit' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Python] Streamlit (0) | 2022.05.03 |
---|