captain-awesome
commited on
Commit
•
c249782
1
Parent(s):
1580ab8
Update app.py
Browse files
app.py
CHANGED
@@ -108,19 +108,19 @@ def create_vector_database(loaded_documents):
|
|
108 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=30, length_function = len)
|
109 |
chunked_documents = text_splitter.split_documents(loaded_documents)
|
110 |
|
111 |
-
# embeddings = HuggingFaceBgeEmbeddings(
|
112 |
-
# model_name = "BAAI/bge-large-en"
|
113 |
-
# )
|
114 |
-
|
115 |
-
model_name = "BAAI/bge-large-en"
|
116 |
-
model_kwargs = {'device': 'cpu'}
|
117 |
-
encode_kwargs = {'normalize_embeddings': False}
|
118 |
embeddings = HuggingFaceBgeEmbeddings(
|
119 |
-
|
120 |
-
model_kwargs=model_kwargs,
|
121 |
-
encode_kwargs=encode_kwargs
|
122 |
)
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
# persist_directory = 'db'
|
125 |
# Create and persist a Chroma vector database from the chunked documents
|
126 |
db = Chroma.from_documents(
|
|
|
108 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=30, length_function = len)
|
109 |
chunked_documents = text_splitter.split_documents(loaded_documents)
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
embeddings = HuggingFaceBgeEmbeddings(
|
112 |
+
model_name = "BAAI/bge-large-en"
|
|
|
|
|
113 |
)
|
114 |
|
115 |
+
# model_name = "BAAI/bge-large-en"
|
116 |
+
# model_kwargs = {'device': 'cpu'}
|
117 |
+
# encode_kwargs = {'normalize_embeddings': False}
|
118 |
+
# embeddings = HuggingFaceBgeEmbeddings(
|
119 |
+
# model_name=model_name,
|
120 |
+
# model_kwargs=model_kwargs,
|
121 |
+
# encode_kwargs=encode_kwargs
|
122 |
+
# )
|
123 |
+
|
124 |
# persist_directory = 'db'
|
125 |
# Create and persist a Chroma vector database from the chunked documents
|
126 |
db = Chroma.from_documents(
|