-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
76 lines (65 loc) · 2.68 KB
/
app.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
72
73
74
75
76
import streamlit as st
import streamlit_authenticator as stauth
# from streamlit_authenticator.utilities.hasher import Hasher
from configs.credentials import credentials
def main():
# No hashing for now, can add it later for security
# # Hash the passwords
# for username, user_data in credentials["usernames"].items():
# user_data["password"] = Hasher([user_data["password"]]).generate()[0]
authenticator = stauth.Authenticate(
credentials, "celo_cookies", "celo_signature", cookie_expiry_days=30
)
name, authentication_status, username = authenticator.login("main")
if authentication_status:
st.write(f"Welcome *{name}*")
authenticator.logout("Logout", "sidebar")
# Add custom CSS to make radio buttons bigger and bold
st.sidebar.markdown(
"""
<style>
.sidebar .radio-text {
font-size: 20px;
font-weight: bold;
}
</style>
""",
unsafe_allow_html=True,
)
# Define the app pages
st.sidebar.title("Navigation")
page = st.sidebar.radio(
"Go to",
["Space Enumerator", "Sample Selector", "Data Labeler", "ML Model Selector", "Explorator Explotator"],
format_func=lambda x: "🔍 " + x if x == "Space Enumerator" else (
"📊 " + x if x == "Sample Selector" else (
"🏷️ " + x if x == "Data Labeler" else (
"🤖 " + x if x == "ML Model Selector" else (
"🧪 " + x if x == "Explorator Explotator" else x
)
)
)
),
key="main_menu"
)
if page == "Space Enumerator":
from streamlit_pages import space_enumerator
space_enumerator.space_enumerator()
elif page == "Sample Selector":
from streamlit_pages import sample_selector
sample_selector.sample_selector()
elif page == "Data Labeler":
from streamlit_pages import data_labeler
data_labeler.data_labeler()
elif page == "ML Model Selector":
from streamlit_pages import ml_model_selector
ml_model_selector.ml_model_selector()
elif page == "Explorator Explotator":
from streamlit_pages import explorator_explotator
explorator_explotator.explorator_explotator()
elif authentication_status == False:
st.error("Username/password is incorrect")
elif authentication_status == None:
st.warning("Please enter your username and password")
if __name__ == "__main__":
main()