Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,22 +4,6 @@ import streamlit.components.v1 as components
|
|
4 |
|
5 |
# FIRST: Set page config before ANY other Streamlit command
|
6 |
st.set_page_config(page_title="Spirituality Q&A", page_icon="🕉️")
|
7 |
-
# Replace "app" with "Home" in sidebar
|
8 |
-
st.markdown("""
|
9 |
-
<style>
|
10 |
-
section[data-testid="stSidebar"] li:first-child div p {
|
11 |
-
visibility: hidden;
|
12 |
-
position: relative;
|
13 |
-
}
|
14 |
-
section[data-testid="stSidebar"] li:first-child div p:after {
|
15 |
-
visibility: visible;
|
16 |
-
position: absolute;
|
17 |
-
top: 0;
|
18 |
-
left: 0;
|
19 |
-
content: 'Home';
|
20 |
-
}
|
21 |
-
</style>
|
22 |
-
""", unsafe_allow_html=True)
|
23 |
|
24 |
# Initialize ALL session state variables right at the beginning
|
25 |
if 'initialized' not in st.session_state:
|
@@ -46,23 +30,11 @@ if 'last_answer' not in st.session_state:
|
|
46 |
if 'show_acknowledgment' not in st.session_state:
|
47 |
st.session_state.show_acknowledgment = False
|
48 |
# Add page change detection
|
49 |
-
if 'current_page' not in st.session_state:
|
50 |
-
st.session_state.current_page = "home"
|
51 |
-
|
52 |
-
# Check if we're returning to the home page from another page
|
53 |
if 'page_loaded' not in st.session_state:
|
54 |
st.session_state.page_loaded = True
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
current_path = st.experimental_get_query_params().get("page", ["home"])[0]
|
59 |
-
# If we're returning to the home page from another page, reset the query and answer
|
60 |
-
if current_path == "home" and st.session_state.current_page != "home":
|
61 |
-
st.session_state.last_query = ""
|
62 |
-
st.session_state.last_answer = None
|
63 |
-
st.session_state.current_page = current_path
|
64 |
-
except:
|
65 |
-
pass
|
66 |
|
67 |
# THEN: Import your modules
|
68 |
from rag_engine import process_query, load_model, cached_load_data_files
|
@@ -283,7 +255,7 @@ if st.session_state.show_acknowledgment:
|
|
283 |
|
284 |
Therefore, with deepest reverence, we express our gratitude to:
|
285 |
|
286 |
-
**The Saints
|
287 |
|
288 |
**The Sacred Texts** that have preserved the eternal truths across millennia, offering light in times of darkness and clarity in times of confusion.
|
289 |
|
@@ -344,7 +316,7 @@ common_questions = [
|
|
344 |
]
|
345 |
|
346 |
# Display heading for common questions
|
347 |
-
st.markdown("###
|
348 |
|
349 |
# Group questions into rows and create buttons (disabled if processing)
|
350 |
question_rows = group_buttons(common_questions, max_chars_per_row=80)
|
|
|
4 |
|
5 |
# FIRST: Set page config before ANY other Streamlit command
|
6 |
st.set_page_config(page_title="Spirituality Q&A", page_icon="🕉️")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
# Initialize ALL session state variables right at the beginning
|
9 |
if 'initialized' not in st.session_state:
|
|
|
30 |
if 'show_acknowledgment' not in st.session_state:
|
31 |
st.session_state.show_acknowledgment = False
|
32 |
# Add page change detection
|
|
|
|
|
|
|
|
|
33 |
if 'page_loaded' not in st.session_state:
|
34 |
st.session_state.page_loaded = True
|
35 |
+
# Reset query state when returning to home page
|
36 |
+
st.session_state.last_query = ""
|
37 |
+
st.session_state.last_answer = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
# THEN: Import your modules
|
40 |
from rag_engine import process_query, load_model, cached_load_data_files
|
|
|
255 |
|
256 |
Therefore, with deepest reverence, we express our gratitude to:
|
257 |
|
258 |
+
**The Saints and Spiritual Masters** whose timeless wisdom illuminates this application. From ancient sages to modern masters, their selfless dedication to uplift humanity through selfless love and spiritual knowledge continues to guide seekers on the path.
|
259 |
|
260 |
**The Sacred Texts** that have preserved the eternal truths across millennia, offering light in times of darkness and clarity in times of confusion.
|
261 |
|
|
|
316 |
]
|
317 |
|
318 |
# Display heading for common questions
|
319 |
+
st.markdown("### Common questions to try:")
|
320 |
|
321 |
# Group questions into rows and create buttons (disabled if processing)
|
322 |
question_rows = group_buttons(common_questions, max_chars_per_row=80)
|