taaha3244 commited on
Commit
9ee3f2a
1 Parent(s): a561d39

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -4,18 +4,17 @@ import uuid
4
  import streamlit as st
5
  from dotenv import load_dotenv
6
  from qdrant_client import models
7
- from utils import setup_openai_embeddings, setup_qdrant_client, delete_collection, is_document_embedded
8
- from embed import embed_documents_into_qdrant
9
- from preprocess import split_documents, update_metadata, load_documents_OCR
10
- from retrieve import retrieve_documents_from_collection
11
- from summarize import summarize_documents
 
12
 
13
  # Load environment variables
14
  load_dotenv()
15
 
16
 
17
-
18
-
19
  def main():
20
  st.sidebar.title("PDF Management")
21
  uploaded_files = st.sidebar.file_uploader("Upload PDF files", type=["pdf"], accept_multiple_files=True)
@@ -42,7 +41,7 @@ def main():
42
 
43
  pages = {
44
  "Lex Document Summarization": page_summarization,
45
- "Chat with RSCA": page_qna,
46
  "Chat with Uploaded Docs": page_chat_with_uploaded_docs,
47
  "Chat with VOO": page_chat_with_voo
48
  }
@@ -91,7 +90,7 @@ def page_summarization(uploaded_files):
91
 
92
  def page_qna(uploaded_files):
93
  """Page for Q&A functionality."""
94
- st.title("Chat with RSCA")
95
  user_query = st.text_area("Enter your question here:", height=300)
96
  if st.button('Get Answer'):
97
  if user_query:
@@ -192,7 +191,7 @@ def add_docs_to_current_chat(files_info):
192
  def handle_query(query):
193
  """Retrieve answers based on the query."""
194
  try:
195
- answer = retrieve_documents_from_collection(query, os.getenv('OPENAI_API_KEY'), os.getenv('QDRANT_URL'), os.getenv('QDRANT_API_KEY'),'Lex-v1')
196
  return answer or "No relevant answer found."
197
  except Exception as e:
198
  return f"Error processing the query: {str(e)}"
 
4
  import streamlit as st
5
  from dotenv import load_dotenv
6
  from qdrant_client import models
7
+
8
+ from Lex.utils import setup_openai_embeddings, setup_qdrant_client, delete_collection, is_document_embedded
9
+ from Lex.embed import embed_documents_into_qdrant
10
+ from Lex.preprocess import split_documents, update_metadata, load_documents_OCR
11
+ from Lex.retrieve import retrieve_documents, retrieve_documents_from_collection
12
+ from Lex.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)
 
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
 
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:
 
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)}"