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