SHAMIL SHAHBAZ AWAN commited on
Commit
3e42beb
·
verified ·
1 Parent(s): c04de34

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -17,8 +17,14 @@ st.markdown(
17
  background-position: center center;
18
  background-repeat: no-repeat;
19
  }}
20
- /* Set title and footer text color to black */
21
- h1, h2, h3, h4, h5, h6, p {{
 
 
 
 
 
 
22
  color: black; /* Set text color to black */
23
  }}
24
 
@@ -86,6 +92,9 @@ else:
86
  # If the index file doesn't exist, create a new one
87
  index = faiss.IndexFlatL2(embedder.get_sentence_embedding_dimension())
88
 
 
 
 
89
  # Function to load text from PDF
90
  def load_pdf_text(file_path):
91
  """Extract text from the given PDF file."""
@@ -106,6 +115,8 @@ def chunk_text(text, chunk_size=500, overlap=100):
106
  # Process the document and update vector store
107
  def process_and_store_document(file_path):
108
  """Process the PDF document, chunk text, generate embeddings, and store them in FAISS."""
 
 
109
  st.info("Processing PDF document...")
110
 
111
  # Extract text from the PDF file
 
17
  background-position: center center;
18
  background-repeat: no-repeat;
19
  }}
20
+
21
+ /* Ensure title is black */
22
+ h1 {{
23
+ color: black !important; /* Force title color to black */
24
+ }}
25
+
26
+ /* Set footer text color to white */
27
+ h2, h3, h4, h5, h6, p {{
28
  color: black; /* Set text color to black */
29
  }}
30
 
 
92
  # If the index file doesn't exist, create a new one
93
  index = faiss.IndexFlatL2(embedder.get_sentence_embedding_dimension())
94
 
95
+ # Variable to hold chunks globally
96
+ chunks = []
97
+
98
  # Function to load text from PDF
99
  def load_pdf_text(file_path):
100
  """Extract text from the given PDF file."""
 
115
  # Process the document and update vector store
116
  def process_and_store_document(file_path):
117
  """Process the PDF document, chunk text, generate embeddings, and store them in FAISS."""
118
+ global chunks # Make chunks global to access in the query part
119
+
120
  st.info("Processing PDF document...")
121
 
122
  # Extract text from the PDF file