Spaces:
Sleeping
Sleeping
Commit
•
b31777c
1
Parent(s):
d181195
Update app.py
Browse files
app.py
CHANGED
@@ -47,29 +47,32 @@ def get_text_chunks(text):
|
|
47 |
return chunks
|
48 |
|
49 |
|
50 |
-
|
51 |
-
# # embeddings = OpenAIEmbeddings()
|
52 |
|
53 |
-
|
54 |
-
#
|
55 |
-
# embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-xl")
|
56 |
|
57 |
-
#
|
58 |
-
#
|
59 |
-
|
60 |
-
# # instruction = "Represent the Science title:"
|
61 |
-
# # embeddings = model.encode([[instruction, sentence]])
|
62 |
|
63 |
-
|
64 |
-
#
|
|
|
|
|
|
|
|
|
65 |
|
66 |
-
#
|
67 |
-
|
68 |
-
# #
|
69 |
-
# vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
|
70 |
-
# print('FAISS succeeds: ')
|
71 |
|
72 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
# def get_conversation_chain(vectorstore):
|
75 |
# # llm = ChatOpenAI()
|
|
|
47 |
return chunks
|
48 |
|
49 |
|
50 |
+
def get_vectorstore(text_chunks):
|
|
|
51 |
|
52 |
+
st.write('Here in vector store....', unsafe_allow_html=True)
|
53 |
+
# embeddings = OpenAIEmbeddings()
|
|
|
54 |
|
55 |
+
# pip install InstructorEmbedding
|
56 |
+
# pip install sentence-transformers==2.2.2
|
57 |
+
embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-xl")
|
|
|
|
|
58 |
|
59 |
+
st.write('Here in vector store - got embeddings ', unsafe_allow_html=True)
|
60 |
+
# from InstructorEmbedding import INSTRUCTOR
|
61 |
+
# model = INSTRUCTOR('hkunlp/instructor-xl')
|
62 |
+
# sentence = "3D ActionSLAM: wearable person tracking in multi-floor environments"
|
63 |
+
# instruction = "Represent the Science title:"
|
64 |
+
# embeddings = model.encode([[instruction, sentence]])
|
65 |
|
66 |
+
# embeddings = model.encode(text_chunks)
|
67 |
+
print('have Embeddings: ')
|
|
|
|
|
|
|
68 |
|
69 |
+
# text_chunks="this is a test"
|
70 |
+
# FAISS, Chroma and other vector databases
|
71 |
+
#
|
72 |
+
# vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
|
73 |
+
print('FAISS succeeds: ')
|
74 |
+
|
75 |
+
return vectorstore
|
76 |
|
77 |
# def get_conversation_chain(vectorstore):
|
78 |
# # llm = ChatOpenAI()
|