Spaces:
Running
Running
Download src/util/matrix.py from NarendraMall/Image-Similarity: direct link, hf CLI and curl.
- Browser
- Download file 108 Bytes
-
https://huggingface.co/spaces/NarendraMall/Image-Similarity/resolve/main/src/util/matrix.py
- Command line
-
hf download hf://spaces/NarendraMall/Image-Similarity/src/util/matrix.py
-
curl -L -o matrix.py https://huggingface.co/spaces/NarendraMall/Image-Similarity/resolve/main/src/util/matrix.py
108 Bytes
| from numpy.linalg import norm | |
| import numpy as np | |
| def cosine(x, y): | |
| return np.dot(x,y)/(norm(x)*norm(y)) |