Vincent Claes
commited on
Commit
•
3bdfaef
1
Parent(s):
61deb82
rearrange results better
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ import utils
|
|
10 |
from prompts import preprocess, recruiting_assistant, matches, intro
|
11 |
|
12 |
llm = ChatOpenAI(temperature=0.0, openai_api_key=os.environ["OPENAI"])
|
13 |
-
|
14 |
|
15 |
def preprocess_resume(llm, resume) -> str:
|
16 |
result = preprocess.preprocess_resume(llm, resume)
|
@@ -61,28 +61,38 @@ def postprocess_vancy(vacancies, resume):
|
|
61 |
skills_match, "skills_match_predicted"
|
62 |
)
|
63 |
print("getting matched skills ...")
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
if element["resume_index"] > 0 and element["vacancy_index"] > 0
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
for element in matched_skills:
|
70 |
vacancy = vacancy.lower().replace(
|
71 |
element.lower(),
|
72 |
f'<span style="background-color: yellow;">{element}</span>',
|
73 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
vacancy_formatted = vacancy.replace(".,", "<br/>")
|
75 |
-
vacancy_formatted = f"VACATURE {i
|
76 |
matches_html = "<br/> - ".join(matched_skills)
|
77 |
resume_matched_formatted = (
|
78 |
-
f"Score: {
|
79 |
)
|
80 |
-
|
81 |
-
print("sorting matches based on the score.")
|
82 |
-
matches_score_tuples.sort(key=lambda x: x[-1], reverse=True)
|
83 |
-
print("constructing html table.")
|
84 |
-
for element in matches_score_tuples:
|
85 |
-
html_table += f"<tr><td>{element[0]}</td><td>{element[1]}</td></tr>"
|
86 |
html_table += "</table>"
|
87 |
return html_table
|
88 |
|
|
|
10 |
from prompts import preprocess, recruiting_assistant, matches, intro
|
11 |
|
12 |
llm = ChatOpenAI(temperature=0.0, openai_api_key=os.environ["OPENAI"])
|
13 |
+
MAX_SKILLS = 10
|
14 |
|
15 |
def preprocess_resume(llm, resume) -> str:
|
16 |
result = preprocess.preprocess_resume(llm, resume)
|
|
|
61 |
skills_match, "skills_match_predicted"
|
62 |
)
|
63 |
print("getting matched skills ...")
|
64 |
+
counter = 0
|
65 |
+
matched_skills = []
|
66 |
+
for element in skills_match_predicted:
|
67 |
+
if element["resume_index"] > 0 and element["vacancy_index"] > 0:
|
68 |
+
counter += 1
|
69 |
+
if counter > MAX_SKILLS:
|
70 |
+
break
|
71 |
+
matched_skills.append(element["content"])
|
72 |
+
|
73 |
+
# matched_skills = [
|
74 |
+
# element["content"]
|
75 |
+
# for element in skills_match_predicted
|
76 |
+
# if element["resume_index"] > 0 and element["vacancy_index"] > 0
|
77 |
+
# ]
|
78 |
for element in matched_skills:
|
79 |
vacancy = vacancy.lower().replace(
|
80 |
element.lower(),
|
81 |
f'<span style="background-color: yellow;">{element}</span>',
|
82 |
)
|
83 |
+
matches_score_tuples.append((vacancy, matched_skills, len(matched_skills)))
|
84 |
+
print("sorting matches based on the score.")
|
85 |
+
matches_score_tuples.sort(key=lambda x: x[-1], reverse=True)
|
86 |
+
print("constructing html table.")
|
87 |
+
for i, element in enumerate(matches_score_tuples, 1):
|
88 |
+
vacancy, matched_skills, score = element
|
89 |
vacancy_formatted = vacancy.replace(".,", "<br/>")
|
90 |
+
vacancy_formatted = f"VACATURE {i}:<br/>{vacancy_formatted}"
|
91 |
matches_html = "<br/> - ".join(matched_skills)
|
92 |
resume_matched_formatted = (
|
93 |
+
f"Score: {score}<br/>-{matches_html}"
|
94 |
)
|
95 |
+
html_table += f"<tr><td>{vacancy_formatted}</td><td>{resume_matched_formatted}</td></tr>"
|
|
|
|
|
|
|
|
|
|
|
96 |
html_table += "</table>"
|
97 |
return html_table
|
98 |
|