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