Download vector_store.py from shani67/DSA2: direct link, hf CLI and curl.
- Browser
- Download file 481 Bytes
-
https://huggingface.co/spaces/shani67/DSA2/resolve/main/vector_store.py
- Command line
-
hf download hf://spaces/shani67/DSA2/vector_store.py
-
curl -L -o vector_store.py https://huggingface.co/spaces/shani67/DSA2/resolve/main/vector_store.py
481 Bytes
| from langchain_community.vectorstores import FAISS | |
| from langchain_community.embeddings import HuggingFaceEmbeddings | |
| def get_embedding_model(): | |
| embedding_model = HuggingFaceEmbeddings( | |
| model_name="BAAI/bge-small-en-v1.5" | |
| ) | |
| return embedding_model | |
| def load_vector_store(): | |
| embeddings = get_embedding_model() | |
| vectorstore = FAISS.load_local( | |
| ".", | |
| embeddings, | |
| allow_dangerous_deserialization=True | |
| ) | |
| return vectorstore |