streamlit第三方模块:Components • Streamlit
streamlit示例:App Gallery • Streamlit
最终部署结果:
如图:
一、GITHUB中:
1.Create a new repository
2.上传需要运行的代码文件
3.还要上传requirements.txt
二、streamlit中:
1.进入个人中心https://share.streamlit.io/直接点击创建
2.选择对应的github刚才建立的repository
ps:可以选择设置登录密码:Authentication without SSO - Streamlit Docs
在需要运行的文件的最前面复制这个:
# streamlit_app.py
import hmac
import streamlit as st
def check_password():
"""Returns `True` if the user had the correct password."""
def password_entered():
"""Checks whether a password entered by the user is correct."""
if hmac.compare_digest(st.session_state["password"], st.secrets["password"]):
st.session_state["password_correct"] = True
del st.session_state["password"] # Don't store the password.
else:
st.session_state["password_correct"] = False
# Return True if the password is validated.
if st.session_state.get("password_correct", False):
return True
# Show input for password.
st.text_input(
"Password", type="password", on_change=password_entered, key="password"
)
if "password_correct" in st.session_state:
st.error("😕 Password incorrect")
return False
if not check_password():
st.stop() # Do not continue if check_password is not True.