shamaayan's picture
custom code
0d1febe
raw
history blame
264 Bytes
import numpy as np
from typing import List, Union
def predict_fn(data: Union[List[str], str], model):
outputs = model(input_texts, padding=False, truncation=True)
embeddings = [np.array(r[0]).mean(axis=0).tolist() for r in outputs]
return embeddings