Spaces:
Sleeping
Sleeping
Download modules/similarity.py from teoaivalis/InfluenceAnalyzerDemo: direct link, hf CLI and curl.
- Browser
- Download file 163 Bytes
-
https://huggingface.co/spaces/teoaivalis/InfluenceAnalyzerDemo/resolve/main/modules/similarity.py
- Command line
-
hf download hf://spaces/teoaivalis/InfluenceAnalyzerDemo/modules/similarity.py
-
curl -L -o similarity.py https://huggingface.co/spaces/teoaivalis/InfluenceAnalyzerDemo/resolve/main/modules/similarity.py
163 Bytes
| from scipy.spatial.distance import cosine | |
| def compute_similarity(embedding1, embedding2): | |
| return 1 - cosine(embedding1, embedding2) # higher is more similar | |