Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -85,16 +85,19 @@ def test_rag(qa, query):
|
|
85 |
return qa.run(query)
|
86 |
|
87 |
user_prompt = st.chat_input("Ask me anything about the content of the PDF(s):")
|
|
|
88 |
if user_prompt:
|
89 |
st.session_state.messages.append({'role': 'user', "content": user_prompt})
|
90 |
books_retriever = test_rag(books_db_client_retriever, user_prompt)
|
|
|
91 |
# Extracting the relevant answer using regex
|
92 |
corrected_text_match = re.search(r"Helpful Answer:(.*)", books_retriever, re.DOTALL)
|
93 |
-
|
94 |
if corrected_text_match:
|
95 |
corrected_text_books = corrected_text_match.group(1).strip()
|
96 |
else:
|
97 |
corrected_text_books = "No helpful answer found."
|
|
|
98 |
st.session_state.messages.append({'role': 'assistant', "content": corrected_text_books})
|
99 |
|
100 |
for message in st.session_state.messages:
|
|
|
85 |
return qa.run(query)
|
86 |
|
87 |
user_prompt = st.chat_input("Ask me anything about the content of the PDF(s):")
|
88 |
+
print("user input:", user_prompt)
|
89 |
if user_prompt:
|
90 |
st.session_state.messages.append({'role': 'user', "content": user_prompt})
|
91 |
books_retriever = test_rag(books_db_client_retriever, user_prompt)
|
92 |
+
print("books retriver:",books_retriever)
|
93 |
# Extracting the relevant answer using regex
|
94 |
corrected_text_match = re.search(r"Helpful Answer:(.*)", books_retriever, re.DOTALL)
|
95 |
+
print("corrected text match:", corrected_text_match)
|
96 |
if corrected_text_match:
|
97 |
corrected_text_books = corrected_text_match.group(1).strip()
|
98 |
else:
|
99 |
corrected_text_books = "No helpful answer found."
|
100 |
+
print("corrected text books: ",corrected_text_books)
|
101 |
st.session_state.messages.append({'role': 'assistant', "content": corrected_text_books})
|
102 |
|
103 |
for message in st.session_state.messages:
|