Update app.py
Browse files
app.py
CHANGED
|
@@ -45,9 +45,10 @@ def split_into_chunks(text, chunk_size=100):
|
|
| 45 |
|
| 46 |
return chunks
|
| 47 |
|
| 48 |
-
def semantic_search(query,
|
| 49 |
-
if
|
| 50 |
-
|
|
|
|
| 51 |
chunks = split_into_chunks(document)
|
| 52 |
response = query_similarity(query, chunks)
|
| 53 |
return format_output(response)
|
|
|
|
| 45 |
|
| 46 |
return chunks
|
| 47 |
|
| 48 |
+
def semantic_search(query, file_path):
|
| 49 |
+
if file_path is not None:
|
| 50 |
+
with open(file_path, 'r', encoding='utf-8') as file:
|
| 51 |
+
document = file.read()
|
| 52 |
chunks = split_into_chunks(document)
|
| 53 |
response = query_similarity(query, chunks)
|
| 54 |
return format_output(response)
|