Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,10 +10,13 @@ from langchain.chains import ConversationalRetrievalChain
|
|
| 10 |
from htmlTemplates import css, bot_template, user_template
|
| 11 |
from langchain.llms import HuggingFaceHub
|
| 12 |
|
| 13 |
-
from langchain.embeddings import HuggingFaceInstructEmbeddings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-base")
|
| 16 |
-
print(embeddings.embed_query("This should now work."))
|
| 17 |
|
| 18 |
def get_pdf_text(pdf_docs):
|
| 19 |
text = ""
|
|
@@ -38,7 +41,8 @@ def get_text_chunks(text):
|
|
| 38 |
def get_vectorstore(text_chunks):
|
| 39 |
#embeddings = OpenAIEmbeddings()
|
| 40 |
#embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-xl")
|
| 41 |
-
embeddings=HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-base")
|
|
|
|
| 42 |
vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
|
| 43 |
return vectorstore
|
| 44 |
|
|
|
|
| 10 |
from htmlTemplates import css, bot_template, user_template
|
| 11 |
from langchain.llms import HuggingFaceHub
|
| 12 |
|
| 13 |
+
#from langchain.embeddings import HuggingFaceInstructEmbeddings
|
| 14 |
+
#embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-base")
|
| 15 |
+
#print(embeddings.embed_query("This should now work."))
|
| 16 |
+
|
| 17 |
+
from langchain.embeddings import HuggingFaceEmbeddings
|
| 18 |
+
#embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
|
| 19 |
|
|
|
|
|
|
|
| 20 |
|
| 21 |
def get_pdf_text(pdf_docs):
|
| 22 |
text = ""
|
|
|
|
| 41 |
def get_vectorstore(text_chunks):
|
| 42 |
#embeddings = OpenAIEmbeddings()
|
| 43 |
#embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-xl")
|
| 44 |
+
#embeddings=HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-base")
|
| 45 |
+
embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
|
| 46 |
vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
|
| 47 |
return vectorstore
|
| 48 |
|