taaha3244 commited on
Commit
c8ffb29
1 Parent(s): 0c3c33c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -8,7 +8,7 @@ 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 retrieve_documents, retrieve_documents_from_collection
12
  from summarize import summarize_documents
13
 
14
  # Load environment variables
@@ -41,7 +41,7 @@ def main():
41
 
42
  pages = {
43
  "Lex Document Summarization": page_summarization,
44
- "Chat with Data Bank": page_qna,
45
  "Chat with Uploaded Docs": page_chat_with_uploaded_docs,
46
  "Chat with VOO": page_chat_with_voo
47
  }
@@ -90,8 +90,8 @@ def page_summarization(uploaded_files):
90
 
91
  def page_qna(uploaded_files):
92
  """Page for Q&A functionality."""
93
- st.title("Chat with Data Bank")
94
- user_query = st.text_area("Enter your question here:", height=300)
95
  if st.button('Get Answer'):
96
  if user_query:
97
  answer = handle_query(user_query)
@@ -106,7 +106,7 @@ def page_qna(uploaded_files):
106
  def page_chat_with_uploaded_docs(uploaded_files):
107
  """Page for chatting with uploaded documents."""
108
  st.title("Chat with Uploaded Documents")
109
- user_query = st.text_area("Enter your question here:", height=300)
110
  if st.button('Get Answer'):
111
  if user_query:
112
  answer = handle_uploaded_docs_query(user_query, st.session_state['uploaded_collection_name'])
@@ -128,7 +128,7 @@ def page_chat_with_uploaded_docs(uploaded_files):
128
  def page_chat_with_voo(uploaded_files):
129
  """Page for chatting with VOO documents."""
130
  st.title("Chat with VOO")
131
- user_query = st.text_area("Enter your question here:", height=300)
132
  if st.button('Get Answer'):
133
  if user_query:
134
  answer = handle_voo_query(user_query)
@@ -191,7 +191,7 @@ def add_docs_to_current_chat(files_info):
191
  def handle_query(query):
192
  """Retrieve answers based on the query."""
193
  try:
194
- answer = retrieve_documents(query, os.getenv('OPENAI_API_KEY'), os.getenv('QDRANT_URL'), os.getenv('QDRANT_API_KEY'))
195
  return answer or "No relevant answer found."
196
  except Exception as e:
197
  return f"Error processing the query: {str(e)}"
 
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
 
41
 
42
  pages = {
43
  "Lex Document Summarization": page_summarization,
44
+ "Chat with RSCA": page_qna,
45
  "Chat with Uploaded Docs": page_chat_with_uploaded_docs,
46
  "Chat with VOO": page_chat_with_voo
47
  }
 
90
 
91
  def page_qna(uploaded_files):
92
  """Page for Q&A functionality."""
93
+ st.title("Chat with RSCA")
94
+ user_query = st.text_area("Enter your question here:", height=200)
95
  if st.button('Get Answer'):
96
  if user_query:
97
  answer = handle_query(user_query)
 
106
  def page_chat_with_uploaded_docs(uploaded_files):
107
  """Page for chatting with uploaded documents."""
108
  st.title("Chat with Uploaded Documents")
109
+ user_query = st.text_area("Enter your question here:", height=200)
110
  if st.button('Get Answer'):
111
  if user_query:
112
  answer = handle_uploaded_docs_query(user_query, st.session_state['uploaded_collection_name'])
 
128
  def page_chat_with_voo(uploaded_files):
129
  """Page for chatting with VOO documents."""
130
  st.title("Chat with VOO")
131
+ user_query = st.text_area("Enter your question here:", height=200)
132
  if st.button('Get Answer'):
133
  if user_query:
134
  answer = handle_voo_query(user_query)
 
191
  def handle_query(query):
192
  """Retrieve answers based on the query."""
193
  try:
194
+ answer = retrieve_documents_from_collection(query, os.getenv('OPENAI_API_KEY'), os.getenv('QDRANT_URL'), os.getenv('QDRANT_API_KEY'),'Lex-v1')
195
  return answer or "No relevant answer found."
196
  except Exception as e:
197
  return f"Error processing the query: {str(e)}"