radio-embed / radio_embed /radio_embed.py
freemt
Update workflows to include pip install sentence-transformers
f88c21c
raw
history blame
421 Bytes
"""Embed input."""
import numpy
from hf_model_s_cpu import model_s
from logzero import logger
try:
model = model_s()
except Exception as _:
logger.exception(_)
raise SystemExit(1) from _
def radio_embed(
text: str,
) -> numpy.ndarray:
"""Embed input."""
try:
_ = model.encode(text.strip().splitlines())
except Exception as _:
logger.exception(_)
raise
return _