-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwavelets.py
More file actions
104 lines (76 loc) · 2.28 KB
/
wavelets.py
File metadata and controls
104 lines (76 loc) · 2.28 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import streamlit as st
import pages
import hashlib
import altair as alt
alt.data_transformers.disable_max_rows()
st.markdown(
"""
<style>
button {
width: 250px !important
}
</style>""",
unsafe_allow_html=True,
)
mapping = {
"Home": pages.show_homepage,
"DWT basics": pages.show_dwt_basics,
"DWT Shrinkage": pages.show_dwt_shrinkage,
"DWT and Scalograms": pages.show_scalograms,
"DWT Clustering": pages.show_clustering,
"Summary": pages.show_summary,
}
def show_page(page):
st.session_state.page = page
def show_nav_buttons(page):
keys = list(mapping.keys())
no_cols = 3
cols = st.columns(no_cols)
ind = keys.index(page)
if ind > 0:
title = keys[ind - 1]
cols[0].button(
" ← \u00a0\u00a0\u00a0" + title, on_click=show_page, args=(title,)
)
if ind + 1 < len(mapping):
title = keys[ind + 1]
cols[no_cols - 1].button(
title + "\u00a0\u00a0\u00a0 → ", on_click=show_page, args=(title,)
)
def introduction():
st.header("Introduction")
def show_password():
st.header("This site is password protected")
text = st.text_input("Enter password")
st.session_state.password = text
def get_markdown_text(filename):
with open("md/" + filename + ".md") as f:
lines = f.readlines()
return "".join(lines)
def show_app():
st.sidebar.subheader("Menu")
for t in mapping.keys():
st.sidebar.button(t, on_click=show_page, key="menu" + t, args=(t,))
st.sidebar.markdown(get_markdown_text("about-me"))
if "page" not in st.session_state:
st.session_state.page = "Home"
page = st.session_state.page
func = mapping[page]
func()
st.write("")
show_nav_buttons(page)
def check_password():
PASS = "c750a40e2e5c5c1029326927401d4a21"
if "password" not in st.session_state:
show_password()
hash = hashlib.md5(st.session_state.password.encode()).hexdigest()
else:
hash = hashlib.md5(st.session_state.password.encode()).hexdigest()
if hash != PASS:
show_password()
hash = hashlib.md5(st.session_state.password.encode()).hexdigest()
if hash != PASS:
st.warning("Wrong password")
if hash == PASS:
show_app()
show_app()