Update app.py
Browse files
app.py
CHANGED
@@ -46,4 +46,17 @@ pg = st.navigation(pages=[start_page, type_text_page, upload_file_page, about_pa
|
|
46 |
#pg = st.navigation({"Chapter_Index": [start_page], "Demo": [type_text_page, upload_file_page], "About": [about_page]}) # WITH SECTIONS
|
47 |
pg.run()
|
48 |
|
49 |
-
st.sidebar.text("Project by JA-RAD")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
#pg = st.navigation({"Chapter_Index": [start_page], "Demo": [type_text_page, upload_file_page], "About": [about_page]}) # WITH SECTIONS
|
47 |
pg.run()
|
48 |
|
49 |
+
st.sidebar.text("Project by JA-RAD")
|
50 |
+
|
51 |
+
def filter_chapters_env(df, chapter_column_name):
|
52 |
+
chapter_names = st.sidebar.multiselect(
|
53 |
+
label="Chapter Name", options=df[chapter_column_name].unique(), default=st.session_state.get("chapter_names"), key='filter_chapters', on_change=update_chapters
|
54 |
+
)
|
55 |
+
st.session_state["chapter_names"] = chapter_names
|
56 |
+
|
57 |
+
if chapter_names:
|
58 |
+
df = df[df["chapter_name"].isin(chapter_names)]
|
59 |
+
return df
|
60 |
+
|
61 |
+
def update_chapters():
|
62 |
+
st.session_state["chapter_names"] = st.session_state.filter_chapters
|