Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,6 +16,8 @@ from llama_index.llms.huggingface import (
|
|
| 16 |
from huggingface_hub import login
|
| 17 |
import chromadb as chromadb
|
| 18 |
from chromadb.utils import embedding_functions
|
|
|
|
|
|
|
| 19 |
#
|
| 20 |
|
| 21 |
last = 0
|
|
@@ -86,7 +88,10 @@ def rag(input_text, file):
|
|
| 86 |
# documents = []
|
| 87 |
# for f in file:
|
| 88 |
# documents += SimpleDirectoryReader(f).load_data()
|
| 89 |
-
f = file + "*.pdf"
|
|
|
|
|
|
|
|
|
|
| 90 |
documents = SimpleDirectoryReader(f).load_data()
|
| 91 |
index = VectorStoreIndex.from_documents(documents)
|
| 92 |
# collection.add(
|
|
|
|
| 16 |
from huggingface_hub import login
|
| 17 |
import chromadb as chromadb
|
| 18 |
from chromadb.utils import embedding_functions
|
| 19 |
+
import shutil
|
| 20 |
+
import os
|
| 21 |
#
|
| 22 |
|
| 23 |
last = 0
|
|
|
|
| 88 |
# documents = []
|
| 89 |
# for f in file:
|
| 90 |
# documents += SimpleDirectoryReader(f).load_data()
|
| 91 |
+
# f = file + "*.pdf"
|
| 92 |
+
path = "uchat/temp/" + os.path.basename(file) #NB*
|
| 93 |
+
shutil.copyfile(file.name, path)
|
| 94 |
+
f = path
|
| 95 |
documents = SimpleDirectoryReader(f).load_data()
|
| 96 |
index = VectorStoreIndex.from_documents(documents)
|
| 97 |
# collection.add(
|