Spaces:
Runtime error
Runtime error
Download embedding.py from mominah/Chatbot-backend: direct link, hf CLI and curl.
- Browser
- Download file 397 Bytes
-
https://huggingface.co/spaces/mominah/Chatbot-backend/resolve/main/embedding.py
- Command line
-
hf download hf://spaces/mominah/Chatbot-backend/embedding.py
-
curl -L -o embedding.py https://huggingface.co/spaces/mominah/Chatbot-backend/resolve/main/embedding.py
397 Bytes
| from langchain_huggingface import HuggingFaceEmbeddings | |
| def get_embeddings(): | |
| # Initialize HuggingFace embeddings | |
| model_name = "BAAI/bge-small-en" | |
| model_kwargs = {"device": "cpu"} | |
| encode_kwargs = {"normalize_embeddings": True} | |
| embeddings = HuggingFaceEmbeddings( | |
| model_name=model_name, model_kwargs=model_kwargs, encode_kwargs=encode_kwargs | |
| ) | |
| return embeddings |