Spaces:
Running
Running
Update app,py
Browse files
app.py
CHANGED
@@ -30,11 +30,23 @@ if 'last_answer' 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 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
# THEN: Import your modules
|
40 |
from rag_engine import process_query, load_model, cached_load_data_files
|
@@ -255,7 +267,7 @@ if st.session_state.show_acknowledgment:
|
|
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,7 +328,7 @@ common_questions = [
|
|
316 |
]
|
317 |
|
318 |
# Display heading for common questions
|
319 |
-
st.markdown("###
|
320 |
|
321 |
# Group questions into rows and create buttons (disabled if processing)
|
322 |
question_rows = group_buttons(common_questions, max_chars_per_row=80)
|
@@ -381,12 +393,20 @@ if st.session_state.last_answer is not None:
|
|
381 |
# Add helpful information
|
382 |
st.markdown("---")
|
383 |
|
384 |
-
# About section with
|
385 |
st.markdown("""
|
386 |
### About this app
|
387 |
-
This application uses a Retrieval-Augmented Generation (RAG) system to answer questions about spirituality based on insights from Indian spiritual texts.
|
388 |
-
|
389 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
""")
|
391 |
|
392 |
# Citation note at the bottom - improved with support message
|
|
|
30 |
if 'show_acknowledgment' not in st.session_state:
|
31 |
st.session_state.show_acknowledgment = False
|
32 |
# Add page change detection
|
33 |
+
if 'current_page' not in st.session_state:
|
34 |
+
st.session_state.current_page = "home"
|
35 |
+
|
36 |
+
# Check if we're returning to the home page from another page
|
37 |
if 'page_loaded' not in st.session_state:
|
38 |
st.session_state.page_loaded = True
|
39 |
+
else:
|
40 |
+
# Get the current URL path
|
41 |
+
try:
|
42 |
+
current_path = st.experimental_get_query_params().get("page", ["home"])[0]
|
43 |
+
# If we're returning to the home page from another page, reset the query and answer
|
44 |
+
if current_path == "home" and st.session_state.current_page != "home":
|
45 |
+
st.session_state.last_query = ""
|
46 |
+
st.session_state.last_answer = None
|
47 |
+
st.session_state.current_page = current_path
|
48 |
+
except:
|
49 |
+
pass
|
50 |
|
51 |
# THEN: Import your modules
|
52 |
from rag_engine import process_query, load_model, cached_load_data_files
|
|
|
267 |
|
268 |
Therefore, with deepest reverence, we express our gratitude to:
|
269 |
|
270 |
+
**The Saints, Siddhas, Yogis, 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.
|
271 |
|
272 |
**The Sacred Texts** that have preserved the eternal truths across millennia, offering light in times of darkness and clarity in times of confusion.
|
273 |
|
|
|
328 |
]
|
329 |
|
330 |
# Display heading for common questions
|
331 |
+
st.markdown("### Few questions to try:")
|
332 |
|
333 |
# Group questions into rows and create buttons (disabled if processing)
|
334 |
question_rows = group_buttons(common_questions, max_chars_per_row=80)
|
|
|
393 |
# Add helpful information
|
394 |
st.markdown("---")
|
395 |
|
396 |
+
# About section with enhanced explanations
|
397 |
st.markdown("""
|
398 |
### About this app
|
399 |
+
This application uses a Retrieval-Augmented Generation (RAG) system to answer questions about spirituality based on insights from Indian spiritual texts. It searches through a database of texts to find relevant passages and generates answers based on those passages.
|
400 |
+
|
401 |
+
**Important to note:**
|
402 |
+
- This is not a general chatbot. It is specifically designed to answer spiritual questions based on referenced texts, not to generate historical information or reproduce stories of saints or spiritual leaders.
|
403 |
+
- You may receive slightly different answers when asking the same question multiple times. This variation is intentional and reflects the nuanced nature of spiritual teachings across different traditions.
|
404 |
+
- While you can select a specific number of citations and word limit, the actual response may contain fewer citations based on relevance and availability of information. Similarly, explanations may be shorter than the selected word limit if the retrieved information is concise.
|
405 |
+
- We apologize for any inconsistencies or misinterpretations that may occur. This application is educational in nature and continuously improving.
|
406 |
+
|
407 |
+
We value your feedback to enhance this application. Please visit the *Contacts* page to share your suggestions or report any issues.
|
408 |
+
|
409 |
+
For more information about the source texts used, see *Sources* in the navigation menu.
|
410 |
""")
|
411 |
|
412 |
# Citation note at the bottom - improved with support message
|