presenton/servers/fastapi/scripts/warm_fastembed_cache.py
2026-04-21 17:43:07 +05:45

23 lines
522 B
Python

from pathlib import Path
import sys
FASTAPI_ROOT = Path(__file__).resolve().parents[1]
if str(FASTAPI_ROOT) not in sys.path:
sys.path.insert(0, str(FASTAPI_ROOT))
from services.icon_finder_service import ICON_FINDER_SERVICE
def main() -> None:
if not ICON_FINDER_SERVICE.ensure_initialized():
raise RuntimeError("Failed to prepare fastembed cache for icon search")
print(
f"Fastembed cache prepared at {ICON_FINDER_SERVICE.cache_directory}"
)
if __name__ == "__main__":
main()