MEOW commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,7 +50,7 @@ def get_files_from_input(file_objs):
|
|
| 50 |
return [file_obj.name for file_obj in file_objs]
|
| 51 |
|
| 52 |
# Function to load documents and create the index
|
| 53 |
-
def load_documents(file_objs, url=None):
|
| 54 |
global index, query_engine
|
| 55 |
try:
|
| 56 |
if not file_objs:
|
|
@@ -99,6 +99,8 @@ def load_documents(file_objs, url=None):
|
|
| 99 |
)
|
| 100 |
query_engine = index.as_query_engine(similarity_top_k=20, streaming=True)
|
| 101 |
return "Documents loaded successfully!"
|
|
|
|
|
|
|
| 102 |
|
| 103 |
# Function to handle chat interactions
|
| 104 |
def chat(message,history):
|
|
|
|
| 50 |
return [file_obj.name for file_obj in file_objs]
|
| 51 |
|
| 52 |
# Function to load documents and create the index
|
| 53 |
+
def load_documents(file_objs, url=None, service_context=None):
|
| 54 |
global index, query_engine
|
| 55 |
try:
|
| 56 |
if not file_objs:
|
|
|
|
| 99 |
)
|
| 100 |
query_engine = index.as_query_engine(similarity_top_k=20, streaming=True)
|
| 101 |
return "Documents loaded successfully!"
|
| 102 |
+
except Exception as e:
|
| 103 |
+
return f"Error loading documents: {str(e)}"
|
| 104 |
|
| 105 |
# Function to handle chat interactions
|
| 106 |
def chat(message,history):
|