Update app.py
Browse files
app.py
CHANGED
@@ -1,66 +1,15 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
3 |
for k, v in st.session_state.items():
|
4 |
st.session_state[k] = v
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
start_page = st.Page(
|
14 |
-
page="pages/chapter_index.py",
|
15 |
-
title="Saudi Billing System Chapter Index",
|
16 |
-
icon=":material/home:",
|
17 |
-
default=True,)
|
18 |
-
|
19 |
-
type_text_page = st.Page(
|
20 |
-
page="pages/type_text.py",
|
21 |
-
title="DEMO type text",
|
22 |
-
icon=":material/keyboard:",
|
23 |
-
default=False,)
|
24 |
-
|
25 |
-
upload_file_page = st.Page(
|
26 |
-
page="pages/upload_file.py",
|
27 |
-
title="DEMO upload file (not yet active)",
|
28 |
-
icon=":material/file_upload:",
|
29 |
-
default=False,)
|
30 |
-
|
31 |
-
about_page = st.Page(
|
32 |
-
page="pages/about.py",
|
33 |
-
title="About the app",
|
34 |
-
icon=":material/info:",
|
35 |
-
default=False)
|
36 |
-
|
37 |
-
#PAGES = {
|
38 |
-
# "Chapter Index": "pages/chapter_index.py" ,
|
39 |
-
# "DEMO type_text": "pages/type_text.py",
|
40 |
-
# "DEMO upload file (not yet active)": "pages/upload_file.py",
|
41 |
-
# "About": "pages/about.py",
|
42 |
-
#}
|
43 |
-
|
44 |
-
#selection = st.sidebar.radio("Pages", list(PAGES.keys()))
|
45 |
-
#selection = st.sidebar.radio("Pages", [start_page, type_text_page, upload_file_page, about_page])
|
46 |
-
#page = PAGES[selection]
|
47 |
-
|
48 |
-
# --- NAVIGATION SETUP ---
|
49 |
-
pg = st.navigation(pages=[start_page, type_text_page, upload_file_page, about_page]) # WITHOUT SECTIONS
|
50 |
-
#pg = st.navigation({"Chapter_Index": [start_page], "Demo": [type_text_page, upload_file_page], "About": [about_page]}) # WITH SECTIONS
|
51 |
-
pg.run()
|
52 |
-
|
53 |
-
st.sidebar.text("Project by JA-RAD")
|
54 |
-
|
55 |
-
def filter_chapters_env(df, chapter_column_name):
|
56 |
-
chapter_names = st.sidebar.multiselect(
|
57 |
-
label="Chapter Name", options=df[chapter_column_name].unique(), default=st.session_state.get("chapter_names"), key='filter_chapters', on_change=update_chapters
|
58 |
)
|
59 |
-
|
60 |
-
|
61 |
-
if chapter_names:
|
62 |
-
df = df[df["chapter_name"].isin(chapter_names)]
|
63 |
-
return df
|
64 |
|
65 |
-
def update_chapters():
|
66 |
-
st.session_state["chapter_names"] = st.session_state.filter_chapters
|
|
|
1 |
import streamlit as st
|
2 |
+
from streamlit_option_menu import option_menu
|
3 |
for k, v in st.session_state.items():
|
4 |
st.session_state[k] = v
|
5 |
|
6 |
+
with st.sidebar:
|
7 |
+
selected=option_menu(
|
8 |
+
menu_title = "SBS V2.0 Mapper",
|
9 |
+
options = ["Chapters for selection", "DEMO for text entry", "DEMO for file upload (*not active)", "About the app"]
|
10 |
+
icons = [":material/home:", ":material/keyboard:", ":material/file_upload:", ":material/info:"],
|
11 |
+
menu_icon = "images/menu_book_60dp_75FBFD.png",
|
12 |
+
default_index = 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
)
|
14 |
+
st.sidebar.text("Project by JA-RAD")
|
|
|
|
|
|
|
|
|
15 |
|
|
|
|