TF-Keras
music-squid / example.py
calixtemayoraz's picture
LFS on main
c4e2043
Raw
History Blame Contribute Delete
931 Bytes
"""
Copyright (c) : Calixte Mayoraz 2024
https://gitlab.com/calixtemayoraz
This is an example showing how to get predictions from the model
"""
from src import MusicSquidModel
from scipy.spatial.distance import cosine, euclidean
if __name__ == '__main__':
# link to three files on your hard drive...
file_1 = ""
file_2 = ""
file_3 = ""
msm = MusicSquidModel()
emb_1 = msm.embed(file_1)
emb_2 = msm.embed(file_2)
emb_3 = msm.embed(file_3)
print(f"Cosine Distance between 1 and 2: {cosine(emb_1, emb_2)}")
print(f"Cosine Distance between 1 and 3: {cosine(emb_1, emb_3)}")
print(f"Cosine Distance between 2 and 3: {cosine(emb_2, emb_3)}")
print("---")
print(f"Euclidean Distance between 1 and 2: {euclidean(emb_1, emb_2)}")
print(f"Euclidean Distance between 1 and 3: {euclidean(emb_1, emb_3)}")
print(f"Euclidean Distance between 2 and 3: {euclidean(emb_2, emb_3)}")