Spaces:
Sleeping
Sleeping
mrfirdauss
commited on
Commit
•
6012fba
1
Parent(s):
34571d7
Upload folder using huggingface_hub
Browse files- classificator.py +9 -1
- requirements.txt +2 -1
classificator.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from sentence_transformers import SentenceTransformer
|
2 |
from sklearn.metrics.pairwise import cosine_similarity
|
3 |
import numpy as np
|
|
|
4 |
import pickle
|
5 |
st = SentenceTransformer('all-mpnet-base-v2')
|
6 |
filename = 'svc.pkl'
|
@@ -37,7 +38,14 @@ def predict(cv, job):
|
|
37 |
skill_similarity = cosine_similarity(st.encode(cv['skills']).reshape(1,-1), st.encode(job['skills']).reshape(1,-1))[0][0]
|
38 |
score_yoe = 0.5 if diffYoe == -1 else (0 if diffYoe < 0 else 1)
|
39 |
score = 0.35 * role_req_exp + 0.1 * role_pos + 0.15 * major_similarity + 0.3* score_yoe + 0.1 * skill_similarity
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
res = model.predict(X)
|
42 |
results['score'] = model.predict_proba(X)[:, 1]
|
43 |
results['is_accepted'] = np.argmax(res)
|
|
|
1 |
from sentence_transformers import SentenceTransformer
|
2 |
from sklearn.metrics.pairwise import cosine_similarity
|
3 |
import numpy as np
|
4 |
+
import pandas as pd
|
5 |
import pickle
|
6 |
st = SentenceTransformer('all-mpnet-base-v2')
|
7 |
filename = 'svc.pkl'
|
|
|
38 |
skill_similarity = cosine_similarity(st.encode(cv['skills']).reshape(1,-1), st.encode(job['skills']).reshape(1,-1))[0][0]
|
39 |
score_yoe = 0.5 if diffYoe == -1 else (0 if diffYoe < 0 else 1)
|
40 |
score = 0.35 * role_req_exp + 0.1 * role_pos + 0.15 * major_similarity + 0.3* score_yoe + 0.1 * skill_similarity
|
41 |
+
data = [{
|
42 |
+
'role_req-exp': role_req_exp,
|
43 |
+
'role_pos': role_pos,
|
44 |
+
'major_similarity': major_similarity,
|
45 |
+
'skill_similarity': skill_similarity,
|
46 |
+
'score': score
|
47 |
+
}]
|
48 |
+
X = pd.DataFrame.from_dict(data)
|
49 |
res = model.predict(X)
|
50 |
results['score'] = model.predict_proba(X)[:, 1]
|
51 |
results['is_accepted'] = np.argmax(res)
|
requirements.txt
CHANGED
@@ -6,4 +6,5 @@ uvicorn[standard]
|
|
6 |
PyPDF2
|
7 |
sentence_transformers
|
8 |
scikit-learn
|
9 |
-
numpy
|
|
|
|
6 |
PyPDF2
|
7 |
sentence_transformers
|
8 |
scikit-learn
|
9 |
+
numpy
|
10 |
+
pandas
|