Spaces:
Runtime error
Runtime error
kristada673
commited on
Commit
•
4b2f3f8
1
Parent(s):
4af7d90
Update app.py
Browse files
app.py
CHANGED
@@ -8,13 +8,13 @@ os.environ['OPENAI_API_KEY'] = os.getenv("OPENAI_API_KEY")
|
|
8 |
loaders = [UnstructuredPDFLoader(glob.glob("*.pdf"))]
|
9 |
|
10 |
# Create the index, if it does not exist, and save it
|
11 |
-
if not os.path.isfile('
|
12 |
from langchain.vectorstores import Chroma
|
13 |
index = VectorstoreIndexCreator(vectorstore_cls=Chroma, vectorstore_kwargs={ "persist_directory": "VectorStoreIndex/"}).from_loaders(loaders)
|
14 |
index.vectorstore.persist()
|
15 |
|
16 |
# Load the saved index
|
17 |
-
index_saved = VectorstoreIndexCreator().from_persistent_index("
|
18 |
|
19 |
description = '''This is an AI conversational agent that has studied the Asom Barta newspapers over the last 1 year, from June 2022 to May 2023. You can ask it any question pertaining to this period, and it will answer it.
|
20 |
\n\nThe AI can only frame its answers based on its worldview attained from the Asom Barta newspapers. If you ask it about anything not pertaining to the content of the
|
|
|
8 |
loaders = [UnstructuredPDFLoader(glob.glob("*.pdf"))]
|
9 |
|
10 |
# Create the index, if it does not exist, and save it
|
11 |
+
if not os.path.isfile('chroma-embeddings.parquet'):
|
12 |
from langchain.vectorstores import Chroma
|
13 |
index = VectorstoreIndexCreator(vectorstore_cls=Chroma, vectorstore_kwargs={ "persist_directory": "VectorStoreIndex/"}).from_loaders(loaders)
|
14 |
index.vectorstore.persist()
|
15 |
|
16 |
# Load the saved index
|
17 |
+
index_saved = VectorstoreIndexCreator().from_persistent_index(".")
|
18 |
|
19 |
description = '''This is an AI conversational agent that has studied the Asom Barta newspapers over the last 1 year, from June 2022 to May 2023. You can ask it any question pertaining to this period, and it will answer it.
|
20 |
\n\nThe AI can only frame its answers based on its worldview attained from the Asom Barta newspapers. If you ask it about anything not pertaining to the content of the
|