Spaces:
Running
Running
File size: 670 Bytes
7e327f2 111afa2 7e327f2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from langchain_community.vectorstores import FAISS
from langchain_huggingface import HuggingFaceEmbeddings
def get_embeddings_model():
embeddings = HuggingFaceEmbeddings(
model_name="sentence-transformers/all-MiniLM-L6-v2",
model_kwargs={"device": "cuda"},
encode_kwargs={"normalize_embeddings": True},
show_progress=True,
)
print("Loaded embeddings model")
return embeddings
def get_vector_store():
return FAISS.load_local(
folder_path="vector_store",
embeddings=get_embeddings_model(),
index_name="object_detection_models_faiss_index",
allow_dangerous_deserialization=True,
)
|