Pradeepthi30 commited on
Commit
198d1c2
·
verified ·
1 Parent(s): d65caf3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -27,8 +27,11 @@ def semantic_search(query, top_k=3):
27
  def upload_and_index(file):
28
  global global_docs, nn_model, doc_embeddings
29
  try:
30
- # Read the file content and decode to text
31
- content = file.read().decode("utf-8")
 
 
 
32
  lines = content.splitlines()
33
  global_docs = [line.strip() for line in lines if line.strip()]
34
 
 
27
  def upload_and_index(file):
28
  global global_docs, nn_model, doc_embeddings
29
  try:
30
+ # Read the file content from the file path
31
+ with open(file.name, 'r', encoding='utf-8') as f:
32
+ content = f.read()
33
+
34
+ # Split content into lines and process
35
  lines = content.splitlines()
36
  global_docs = [line.strip() for line in lines if line.strip()]
37