Spaces:
Sleeping
Sleeping
| import faiss | |
| import numpy as np | |
| from src.configs.config import TITLE_EMBEDDINGS_FILE, TITLE_FAISS_INDEX_FILE | |
| def create_title_faiss_index(): | |
| embeddings = np.load(TITLE_EMBEDDINGS_FILE) | |
| dimension = embeddings.shape[1] | |
| index = faiss.IndexFlatL2(dimension) | |
| index.add(embeddings) | |
| faiss.write_index(index, str(TITLE_FAISS_INDEX_FILE)) | |
| return index |