Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,7 @@ import chromadb as chromadb
|
|
| 18 |
from chromadb.utils import embedding_functions
|
| 19 |
import shutil
|
| 20 |
import os
|
|
|
|
| 21 |
#
|
| 22 |
|
| 23 |
last = 0
|
|
@@ -101,7 +102,7 @@ def rag(input_text, file):
|
|
| 101 |
print("pathname=", pathname)
|
| 102 |
print("basename=", os.path.basename(file))
|
| 103 |
print("filename=", file.name)
|
| 104 |
-
documents = SimpleDirectoryReader(file).load_data()
|
| 105 |
index2 = VectorStoreIndex.from_documents(documents)
|
| 106 |
query_engine = index2.as_query_engine()
|
| 107 |
return query_engine.query(input_text)
|
|
|
|
| 18 |
from chromadb.utils import embedding_functions
|
| 19 |
import shutil
|
| 20 |
import os
|
| 21 |
+
from io import
|
| 22 |
#
|
| 23 |
|
| 24 |
last = 0
|
|
|
|
| 102 |
print("pathname=", pathname)
|
| 103 |
print("basename=", os.path.basename(file))
|
| 104 |
print("filename=", file.name)
|
| 105 |
+
documents = SimpleDirectoryReader(file.name).load_data()
|
| 106 |
index2 = VectorStoreIndex.from_documents(documents)
|
| 107 |
query_engine = index2.as_query_engine()
|
| 108 |
return query_engine.query(input_text)
|