Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
31 |
-
|
|
|
|
|
|
|
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 |
|