Spaces:
No application file
No application file
File size: 337 Bytes
5a1b165 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import numpy as np
def load_prompt(path):
with open(path) as f:
lines = f.readlines()
return "".join(lines)
def cosine_similarity(emb1, emb2):
return np.dot(emb1, emb2) / (
(np.dot(emb1, emb1) ** 0.5) * (np.dot(emb2, emb2) ** 0.5)
)
def dot_similarity(emb1, emb2):
return np.dot(emb1, emb2)
|