Spaces:
Sleeping
Sleeping
KushwanthK
commited on
Commit
•
31b27d4
1
Parent(s):
6af21f5
Upload app.py
Browse files
app.py
CHANGED
@@ -234,18 +234,18 @@ print(faiss_index)
|
|
234 |
# def promt_engineer(text):
|
235 |
PROMPT_TEMPLATE = """
|
236 |
Instructions:
|
237 |
-
|
238 |
Answer the question only based on the below context:
|
239 |
- You're a Vedic AI expert in the Hindu Vedic scriptures.
|
240 |
- Questions with out-of-context replay with The question is out of context.
|
241 |
- Always try to provide Keep it simple answers in nice format without incomplete sentence.
|
242 |
- Give the answer atleast 5 seperate lines addition to the title info.
|
243 |
-
- provide Title: <title> Chapter: <chapter> Text No: <textnumber> Page No: <pagenumber>
|
244 |
-
|
245 |
|
246 |
{context}
|
247 |
|
248 |
-
|
249 |
|
250 |
Answer the question based on the above context: {question}
|
251 |
"""
|
@@ -316,7 +316,7 @@ def chat_actions():
|
|
316 |
file_path = "Bhagavad-Gita-As-It-Is.pdf"
|
317 |
text_to_highlight = context_text.strip()
|
318 |
|
319 |
-
if "
|
320 |
st.success("We found some helpful pages related to your question. Please refer to the highlighted sections below.")
|
321 |
display_highlighted_pdf(file_path, result, sources)
|
322 |
else:
|
|
|
234 |
# def promt_engineer(text):
|
235 |
PROMPT_TEMPLATE = """
|
236 |
Instructions:
|
237 |
+
-------------------------------------------------------------------------------------------------------------------------------
|
238 |
Answer the question only based on the below context:
|
239 |
- You're a Vedic AI expert in the Hindu Vedic scriptures.
|
240 |
- Questions with out-of-context replay with The question is out of context.
|
241 |
- Always try to provide Keep it simple answers in nice format without incomplete sentence.
|
242 |
- Give the answer atleast 5 seperate lines addition to the title info.
|
243 |
+
- Only If question is relevent to context provide Title: <title> Chapter: <chapter> Text No: <textnumber> Page No: <pagenumber>
|
244 |
+
-------------------------------------------------------------------------------------------------------------------------------
|
245 |
|
246 |
{context}
|
247 |
|
248 |
+
-------------------------------------------------------------------------------------------------------------------------------
|
249 |
|
250 |
Answer the question based on the above context: {question}
|
251 |
"""
|
|
|
316 |
file_path = "Bhagavad-Gita-As-It-Is.pdf"
|
317 |
text_to_highlight = context_text.strip()
|
318 |
|
319 |
+
if "out of context" not in result:
|
320 |
st.success("We found some helpful pages related to your question. Please refer to the highlighted sections below.")
|
321 |
display_highlighted_pdf(file_path, result, sources)
|
322 |
else:
|