Instructions to use calixtemayoraz/music-squid with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TF-Keras
How to use calixtemayoraz/music-squid with TF-Keras:
# Note: 'keras<3.x' or 'tf_keras' must be installed (legacy) # See https://github.com/keras-team/tf-keras for more details. from huggingface_hub import from_pretrained_keras model = from_pretrained_keras("calixtemayoraz/music-squid") - Notebooks
- Google Colab
- Kaggle
File size: 931 Bytes
c4e2043 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | """
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)}")
|