Spaces:
Build error
Build error
Download backend/semantic_search.py from NCTCMumbai/Customs_Manual_Chatbot: direct link, hf CLI and curl.
- Browser
- Download file 471 Bytes
-
https://huggingface.co/spaces/NCTCMumbai/Customs_Manual_Chatbot/resolve/9b1f03d4d001866af4c62d53ebdaeb11d1a97f09/backend/semantic_search.py
- Command line
-
hf download hf://spaces/NCTCMumbai/Customs_Manual_Chatbot@9b1f03d4d001866af4c62d53ebdaeb11d1a97f09/backend/semantic_search.py
-
curl -L -o semantic_search.py https://huggingface.co/spaces/NCTCMumbai/Customs_Manual_Chatbot/resolve/9b1f03d4d001866af4c62d53ebdaeb11d1a97f09/backend/semantic_search.py
471 Bytes
| import logging | |
| import lancedb | |
| import os | |
| from pathlib import Path | |
| from sentence_transformers import SentenceTransformer | |
| EMB_MODEL_NAME = 'BAAI/llm-embedder' | |
| DB_TABLE_NAME = "Cus_manual_" | |
| # Setting up the logging | |
| logging.basicConfig(level=logging.INFO) | |
| logger = logging.getLogger(__name__) | |
| retriever = SentenceTransformer(EMB_MODEL_NAME) | |
| # db | |
| db_uri = os.path.join(Path(__file__).parents[1], ".lancedb") | |
| db = lancedb.connect(db_uri) | |
| table = db.open_table(DB_TABLE_NAME) | |