Update job_recommendation_inference.py
Browse files
job_recommendation_inference.py
CHANGED
@@ -4,7 +4,7 @@ from sklearn.feature_extraction.text import TfidfVectorizer
|
|
4 |
from sklearn.metrics.pairwise import cosine_similarity
|
5 |
import json
|
6 |
|
7 |
-
def recommend_jobs_for_input_skills(input_hard_skills, input_soft_skills, input_major,
|
8 |
input_hard_skills_vec = tfidf_vectorizer_skills.transform([input_hard_skills])
|
9 |
input_soft_skills_vec = tfidf_vectorizer_skills.transform([input_soft_skills])
|
10 |
input_major_vec = tfidf_vectorizer_majors.transform([input_major])
|
@@ -22,9 +22,9 @@ def recommend_jobs_for_input_skills(input_hard_skills, input_soft_skills, input_
|
|
22 |
combined_similarity = (skills_similarity + major_similarity) / 2
|
23 |
|
24 |
sorted_company_indices = np.argsort(-combined_similarity[0])
|
25 |
-
recommended_companies =
|
26 |
|
27 |
-
return recommended_companies
|
28 |
|
29 |
def handler(event, context):
|
30 |
input_data = json.loads(event['body'])
|
@@ -61,5 +61,5 @@ def handler(event, context):
|
|
61 |
|
62 |
return {
|
63 |
'statusCode': 200,
|
64 |
-
'body': json.dumps(recommended_jobs
|
65 |
-
}
|
|
|
4 |
from sklearn.metrics.pairwise import cosine_similarity
|
5 |
import json
|
6 |
|
7 |
+
def recommend_jobs_for_input_skills(input_hard_skills, input_soft_skills, input_major, jobs, tfidf_vectorizer_skills, tfidf_vectorizer_majors, companies_skills_vec, companies_majors_vec):
|
8 |
input_hard_skills_vec = tfidf_vectorizer_skills.transform([input_hard_skills])
|
9 |
input_soft_skills_vec = tfidf_vectorizer_skills.transform([input_soft_skills])
|
10 |
input_major_vec = tfidf_vectorizer_majors.transform([input_major])
|
|
|
22 |
combined_similarity = (skills_similarity + major_similarity) / 2
|
23 |
|
24 |
sorted_company_indices = np.argsort(-combined_similarity[0])
|
25 |
+
recommended_companies = jobs.iloc[sorted_company_indices]['Major'].values[:3]
|
26 |
|
27 |
+
return recommended_companies.tolist()
|
28 |
|
29 |
def handler(event, context):
|
30 |
input_data = json.loads(event['body'])
|
|
|
61 |
|
62 |
return {
|
63 |
'statusCode': 200,
|
64 |
+
'body': json.dumps(recommended_jobs)
|
65 |
+
}
|