Spaces:
Running on Zero
Running on Zero
Download cli/lib/search_utils.py from Utkarsh736/rag-search-engine: direct link, hf CLI and curl.
- Browser
- Download file 526 Bytes
-
https://huggingface.co/spaces/Utkarsh736/rag-search-engine/resolve/main/cli/lib/search_utils.py
- Command line
-
hf download hf://spaces/Utkarsh736/rag-search-engine/cli/lib/search_utils.py
-
curl -L -o search_utils.py https://huggingface.co/spaces/Utkarsh736/rag-search-engine/resolve/main/cli/lib/search_utils.py
526 Bytes
| import json | |
| import os | |
| DEFAULT_SEARCH_LIMIT = 5 | |
| PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) | |
| DATA_PATH = os.path.join(PROJECT_ROOT, "data", "movies.json") | |
| STOPWORDS_PATH = os.path.join(PROJECT_ROOT, "data", "stopwords.txt") | |
| def load_movies() -> list[dict]: | |
| with open(DATA_PATH, "r") as f: | |
| data = json.load(f) | |
| return data["movies"] | |
| def load_stopwords() -> list[str]: | |
| with open(STOPWORDS_PATH, "r") as f: | |
| content = f.read() | |
| return content.splitlines() | |