Spaces:
Sleeping
Sleeping
add load_dotenv()
Browse files
app.py
CHANGED
|
@@ -19,6 +19,9 @@ from langchain_huggingface import HuggingFaceEmbeddings
|
|
| 19 |
from langchain_community.vectorstores import FAISS
|
| 20 |
from langchain_openai.embeddings import OpenAIEmbeddings
|
| 21 |
from langchain_core.documents import Document
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
system_template = """\
|
| 24 |
Use the following context to answer a users question. If you cannot find the answer in the context, say you don't know the answer."""
|
|
@@ -121,8 +124,10 @@ async def on_chat_start():
|
|
| 121 |
# )
|
| 122 |
|
| 123 |
|
|
|
|
|
|
|
| 124 |
|
| 125 |
-
finetune_embeddings = HuggingFaceEmbeddings(
|
| 126 |
|
| 127 |
finetune_vectorstore = FAISS.from_documents(processed_documents, finetune_embeddings)
|
| 128 |
finetune_retriever = finetune_vectorstore.as_retriever(search_kwargs={"k": 6})
|
|
|
|
| 19 |
from langchain_community.vectorstores import FAISS
|
| 20 |
from langchain_openai.embeddings import OpenAIEmbeddings
|
| 21 |
from langchain_core.documents import Document
|
| 22 |
+
from dotenv import load_dotenv
|
| 23 |
+
|
| 24 |
+
load_dotenv()
|
| 25 |
|
| 26 |
system_template = """\
|
| 27 |
Use the following context to answer a users question. If you cannot find the answer in the context, say you don't know the answer."""
|
|
|
|
| 124 |
# )
|
| 125 |
|
| 126 |
|
| 127 |
+
|
| 128 |
+
model = SentenceTransformer("acpotts/finetuned_arctic")
|
| 129 |
|
| 130 |
+
finetune_embeddings = HuggingFaceEmbeddings(model)
|
| 131 |
|
| 132 |
finetune_vectorstore = FAISS.from_documents(processed_documents, finetune_embeddings)
|
| 133 |
finetune_retriever = finetune_vectorstore.as_retriever(search_kwargs={"k": 6})
|