Vincent Claes
commited on
Commit
·
48b7712
1
Parent(s):
9b6c07d
sort the results based on the score
Browse files
app.py
CHANGED
|
@@ -39,13 +39,12 @@ def postprocess_vancy(vacancies, resume):
|
|
| 39 |
if isinstance(prediction, list):
|
| 40 |
# Convert prediction to HTML table
|
| 41 |
html_table = "<table>"
|
| 42 |
-
|
| 43 |
# Add table headers
|
| 44 |
html_table += "<tr><th>Vacancy</th><th>Match</th></tr>"
|
| 45 |
|
| 46 |
# Prepare a list to hold the futures
|
| 47 |
futures = []
|
| 48 |
-
|
| 49 |
# Create a ThreadPoolExecutor
|
| 50 |
with ThreadPoolExecutor() as executor:
|
| 51 |
for i, vacancy in enumerate(prediction):
|
|
@@ -72,13 +71,18 @@ def postprocess_vancy(vacancies, resume):
|
|
| 72 |
element.lower(),
|
| 73 |
f'<span style="background-color: yellow;">{element}</span>',
|
| 74 |
)
|
| 75 |
-
|
| 76 |
-
|
| 77 |
matches_html = "<br/> - ".join(matched_skills)
|
| 78 |
-
|
| 79 |
f"Score: {len(matched_skills)}<br/>-{matches_html}"
|
| 80 |
)
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
html_table += "</table>"
|
| 83 |
return html_table
|
| 84 |
|
|
|
|
| 39 |
if isinstance(prediction, list):
|
| 40 |
# Convert prediction to HTML table
|
| 41 |
html_table = "<table>"
|
|
|
|
| 42 |
# Add table headers
|
| 43 |
html_table += "<tr><th>Vacancy</th><th>Match</th></tr>"
|
| 44 |
|
| 45 |
# Prepare a list to hold the futures
|
| 46 |
futures = []
|
| 47 |
+
matches_score_tuples = []
|
| 48 |
# Create a ThreadPoolExecutor
|
| 49 |
with ThreadPoolExecutor() as executor:
|
| 50 |
for i, vacancy in enumerate(prediction):
|
|
|
|
| 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 + 1}:<br/>{vacancy_formatted}"
|
| 76 |
matches_html = "<br/> - ".join(matched_skills)
|
| 77 |
+
resume_matched_formatted = (
|
| 78 |
f"Score: {len(matched_skills)}<br/>-{matches_html}"
|
| 79 |
)
|
| 80 |
+
matches_score_tuples.append((vacancy_formatted, resume_matched_formatted, len(matched_skills)))
|
| 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 |
|