Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -116,11 +116,11 @@ def resetChat():
|
|
| 116 |
def rag(input_text, history, jezik, file):
|
| 117 |
# if (btn):
|
| 118 |
# resetChat()
|
| 119 |
-
print(history, input_text)
|
| 120 |
## if (file):
|
| 121 |
documents = []
|
| 122 |
-
for f in file:
|
| 123 |
-
documents += SimpleDirectoryReader(f).load_data()
|
| 124 |
# f = file + "*.pdf"
|
| 125 |
## pathname = os.path.dirname
|
| 126 |
# shutil.copyfile(file.name, path)
|
|
@@ -128,7 +128,7 @@ def rag(input_text, history, jezik, file):
|
|
| 128 |
## print("basename=", os.path.basename(file))
|
| 129 |
## print("filename=", file.name)
|
| 130 |
## documents = SimpleDirectoryReader(file).load_data()
|
| 131 |
-
index2 = VectorStoreIndex.from_documents(documents)
|
| 132 |
## query_engine = index2.as_query_engine()
|
| 133 |
# return query_engine.query(input_text)
|
| 134 |
# return history.append({"role": "assistant", "content": query_engine.query(input_text)})
|
|
|
|
| 116 |
def rag(input_text, history, jezik, file):
|
| 117 |
# if (btn):
|
| 118 |
# resetChat()
|
| 119 |
+
# print(history, input_text)
|
| 120 |
## if (file):
|
| 121 |
documents = []
|
| 122 |
+
#!!! for f in file:
|
| 123 |
+
#!!! documents += SimpleDirectoryReader(f).load_data()
|
| 124 |
# f = file + "*.pdf"
|
| 125 |
## pathname = os.path.dirname
|
| 126 |
# shutil.copyfile(file.name, path)
|
|
|
|
| 128 |
## print("basename=", os.path.basename(file))
|
| 129 |
## print("filename=", file.name)
|
| 130 |
## documents = SimpleDirectoryReader(file).load_data()
|
| 131 |
+
#!!! index2 = VectorStoreIndex.from_documents(documents)
|
| 132 |
## query_engine = index2.as_query_engine()
|
| 133 |
# return query_engine.query(input_text)
|
| 134 |
# return history.append({"role": "assistant", "content": query_engine.query(input_text)})
|