Spaces:
Sleeping
Sleeping
Download embeddings.py from jonathanjordan21/Job_Recommender: direct link, hf CLI and curl.
- Browser
- Download file 898 Bytes
-
https://huggingface.co/spaces/jonathanjordan21/Job_Recommender/resolve/main/embeddings.py
- Command line
-
hf download hf://spaces/jonathanjordan21/Job_Recommender/embeddings.py
-
curl -L -o embeddings.py https://huggingface.co/spaces/jonathanjordan21/Job_Recommender/resolve/main/embeddings.py
898 Bytes
| # Requires transformers>=4.51.0 | |
| import torch | |
| from sentence_transformers import SentenceTransformer | |
| model = SentenceTransformer("Qwen/Qwen3-Embedding-0.6B") | |
| # queries = "hey" | |
| # documents = [ | |
| # "The capital of China is Beijing.", | |
| # "Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun.", | |
| # ] | |
| def rank_jobs(job_description, resumes): | |
| task = "Given a resume, retrieve relevant job description that is suitable for the resume" | |
| queries = resumes | |
| documents = job_description | |
| print("[QUERIES]", queries) | |
| print("[DOCUMENTS]", documents) | |
| query_embeddings = model.encode(queries, prompt=task) | |
| document_embeddings = model.encode(documents) | |
| similarity = model.similarity(query_embeddings, document_embeddings) | |
| return documents, similarity[0].tolist() |