Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,13 +8,12 @@ from qdrant_client import models
|
|
8 |
from utils import setup_openai_embeddings, setup_qdrant_client, delete_collection, is_document_embedded
|
9 |
from embed import embed_documents_into_qdrant
|
10 |
from preprocess import split_documents, update_metadata, load_documents_OCR
|
11 |
-
from retrieve import
|
12 |
from summarize import summarize_documents
|
13 |
|
14 |
# Load environment variables
|
15 |
load_dotenv()
|
16 |
|
17 |
-
|
18 |
def main():
|
19 |
st.sidebar.title("PDF Management")
|
20 |
uploaded_files = st.sidebar.file_uploader("Upload PDF files", type=["pdf"], accept_multiple_files=True)
|
@@ -94,9 +93,10 @@ def page_qna(uploaded_files):
|
|
94 |
user_query = st.text_area("Enter your question here:", height=200)
|
95 |
if st.button('Get Answer'):
|
96 |
if user_query:
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
100 |
else:
|
101 |
st.error("Please enter a question to get an answer.")
|
102 |
# Display stored answer if it exists
|
@@ -109,9 +109,10 @@ def page_chat_with_uploaded_docs(uploaded_files):
|
|
109 |
user_query = st.text_area("Enter your question here:", height=200)
|
110 |
if st.button('Get Answer'):
|
111 |
if user_query:
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
115 |
else:
|
116 |
st.error("Please enter a question to get an answer.")
|
117 |
# Display stored answer if it exists
|
@@ -131,9 +132,10 @@ def page_chat_with_voo(uploaded_files):
|
|
131 |
user_query = st.text_area("Enter your question here:", height=200)
|
132 |
if st.button('Get Answer'):
|
133 |
if user_query:
|
134 |
-
|
135 |
-
|
136 |
-
|
|
|
137 |
else:
|
138 |
st.error("Please enter a question to get an answer.")
|
139 |
# Display stored answer if it exists
|
|
|
8 |
from utils import setup_openai_embeddings, setup_qdrant_client, delete_collection, is_document_embedded
|
9 |
from embed import embed_documents_into_qdrant
|
10 |
from preprocess import split_documents, update_metadata, load_documents_OCR
|
11 |
+
from retrieve import retrieve_documents_from_collection
|
12 |
from summarize import summarize_documents
|
13 |
|
14 |
# Load environment variables
|
15 |
load_dotenv()
|
16 |
|
|
|
17 |
def main():
|
18 |
st.sidebar.title("PDF Management")
|
19 |
uploaded_files = st.sidebar.file_uploader("Upload PDF files", type=["pdf"], accept_multiple_files=True)
|
|
|
93 |
user_query = st.text_area("Enter your question here:", height=200)
|
94 |
if st.button('Get Answer'):
|
95 |
if user_query:
|
96 |
+
if 'data_bank_answer' not in st.session_state or st.session_state['data_bank_answer'] is None:
|
97 |
+
answer = handle_query(user_query)
|
98 |
+
st.session_state['data_bank_answer'] = answer # Store the answer in session state
|
99 |
+
st.write(st.session_state['data_bank_answer'])
|
100 |
else:
|
101 |
st.error("Please enter a question to get an answer.")
|
102 |
# Display stored answer if it exists
|
|
|
109 |
user_query = st.text_area("Enter your question here:", height=200)
|
110 |
if st.button('Get Answer'):
|
111 |
if user_query:
|
112 |
+
if 'uploaded_docs_answer' not in st.session_state or st.session_state['uploaded_docs_answer'] is None:
|
113 |
+
answer = handle_uploaded_docs_query(user_query, st.session_state['uploaded_collection_name'])
|
114 |
+
st.session_state['uploaded_docs_answer'] = answer # Store the answer in session state
|
115 |
+
st.write(st.session_state['uploaded_docs_answer'])
|
116 |
else:
|
117 |
st.error("Please enter a question to get an answer.")
|
118 |
# Display stored answer if it exists
|
|
|
132 |
user_query = st.text_area("Enter your question here:", height=200)
|
133 |
if st.button('Get Answer'):
|
134 |
if user_query:
|
135 |
+
if 'voo_answer' not in st.session_state or st.session_state['voo_answer'] is None:
|
136 |
+
answer = handle_voo_query(user_query)
|
137 |
+
st.session_state['voo_answer'] = answer # Store the answer in session state
|
138 |
+
st.write(st.session_state['voo_answer'])
|
139 |
else:
|
140 |
st.error("Please enter a question to get an answer.")
|
141 |
# Display stored answer if it exists
|