-
Notifications
You must be signed in to change notification settings - Fork 15
/
1_📈_Main.py
71 lines (54 loc) · 2.09 KB
/
1_📈_Main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import pickle
from pathlib import Path
import pandas as pd # pip install pandas openpyxl
import plotly.express as px # pip install plotly-express
import streamlit as st # pip install streamlit
import streamlit_authenticator as stauth # pip install streamlit-authenticator
# emojis: https://www.webfx.com/tools/emoji-cheat-sheet/
st.set_page_config(page_title="streamlit Dashboard", page_icon=":bar_chart:", layout="wide")
hide_bar= """
<style>
[data-testid="stSidebar"][aria-expanded="true"] > div:first-child {
visibility:hidden;
width: 0px;
}
[data-testid="stSidebar"][aria-expanded="false"] > div:first-child {
visibility:hidden;
}
</style>
"""
# --- USER AUTHENTICATION ---
names = ["Peter Parker", "Rebecca Miller","bharath"]
usernames = ["pparker", "rmiller","bharath"]
# load hashed passwords
file_path = Path(__file__).parent / "hashed_pw.pkl"
with file_path.open("rb") as file:
hashed_passwords = pickle.load(file)
authenticator = stauth.Authenticate(names, usernames, hashed_passwords,
"SIPL_dashboard", "abcdef")
name, authentication_status, username = authenticator.login("Login", "main")
if authentication_status == False:
st.error("Username/password is incorrect")
st.markdown(hide_bar, unsafe_allow_html=True)
if authentication_status == None:
st.warning("Please enter your username and password")
st.markdown(hide_bar, unsafe_allow_html=True)
if authentication_status:
# # ---- SIDEBAR ----
st.sidebar.title(f"Welcome {name}")
# st.sidebar.header("select page here :")
st.write("# Welcome to Streamlit!..")
###about ....
st.subheader("Introduction :")
st.text("1. \n2. \n3. \n4. \n5. \n")
st.sidebar.success("Select a page above.")
###---- HIDE STREAMLIT STYLE ----
hide_st_style = """
<style>
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}
header {visibility: hidden;}
</style>
"""
st.markdown(hide_st_style, unsafe_allow_html=True)
authenticator.logout("Logout", "sidebar")