Commit
·
4406f4e
1
Parent(s):
2582aa9
Update app.py
Browse files
app.py
CHANGED
@@ -56,6 +56,7 @@ import gradio as gr
|
|
56 |
import tempfile
|
57 |
import timeit
|
58 |
import textwrap
|
|
|
59 |
|
60 |
FILE_LOADER_MAPPING = {
|
61 |
"csv": (CSVLoader, {"encoding": "utf-8"}),
|
@@ -108,10 +109,11 @@ 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 = HuggingFaceEmbeddings(
|
112 |
-
|
113 |
-
|
114 |
-
)
|
|
|
115 |
|
116 |
# embeddings = HuggingFaceBgeEmbeddings(
|
117 |
# model_name = "BAAI/bge-large-en"
|
|
|
56 |
import tempfile
|
57 |
import timeit
|
58 |
import textwrap
|
59 |
+
from chromadb.utils import embedding_functions
|
60 |
|
61 |
FILE_LOADER_MAPPING = {
|
62 |
"csv": (CSVLoader, {"encoding": "utf-8"}),
|
|
|
109 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=30, length_function = len)
|
110 |
chunked_documents = text_splitter.split_documents(loaded_documents)
|
111 |
|
112 |
+
# embeddings = HuggingFaceEmbeddings(
|
113 |
+
# model_name="sentence-transformers/all-MiniLM-L6-v2"
|
114 |
+
# # model_name = "sentence-transformers/all-mpnet-base-v2"
|
115 |
+
# )
|
116 |
+
embeddings = embedding_functions.SentenceTransformerEmbeddingFunction(model_name="all-MiniLM-L6-v2")
|
117 |
|
118 |
# embeddings = HuggingFaceBgeEmbeddings(
|
119 |
# model_name = "BAAI/bge-large-en"
|