Spaces:
Sleeping
Sleeping
Download modules/comparison.py from deepsu/HR_TOOL_V2: direct link, hf CLI and curl.
- Browser
- Download file 329 Bytes
-
https://huggingface.co/spaces/deepsu/HR_TOOL_V2/resolve/main/modules/comparison.py
- Command line
-
hf download hf://spaces/deepsu/HR_TOOL_V2/modules/comparison.py
-
curl -L -o comparison.py https://huggingface.co/spaces/deepsu/HR_TOOL_V2/resolve/main/modules/comparison.py
329 Bytes
| import torch.nn.functional as F | |
| class Comparison: | |
| def __init__(self, model): | |
| self.model = model | |
| def encode(self, texts): | |
| return self.model.encode(texts, convert_to_tensor=True, normalize_embeddings=True) | |
| def compare(self, resume, jd): | |
| return F.cosine_similarity(jd, resume, dim=-1).tolist() |