Spaces:
Runtime error
Runtime error
add find my new hire page
Browse files- main.py +22 -2
- match_utils.py +8 -1
- static/styles.css +20 -0
- templates/candidate_matcher.html +85 -0
- templates/find_hire.html +32 -0
- templates/find_my_match.html +1 -0
- templates/job_list.html +1 -0
main.py
CHANGED
@@ -13,7 +13,7 @@ from fastapi.staticfiles import StaticFiles
|
|
13 |
from fastapi.responses import HTMLResponse
|
14 |
import pandas as pd
|
15 |
from scrape_onet import get_onet_code, get_onet_description, get_onet_tasks
|
16 |
-
from match_utils import neighborhoods, get_resume, skillNER, sim_result_loop
|
17 |
import time
|
18 |
|
19 |
# APP SETUP
|
@@ -66,4 +66,24 @@ async def post_matches(request: Request, resume: UploadFile = File(...)):
|
|
66 |
skills = await skillNER(resume)
|
67 |
simResults = await sim_result_loop(resume)
|
68 |
print(time.time() - t)
|
69 |
-
return templates.TemplateResponse('find_my_match.html', context={'request': request, 'resume': resume, 'skills': skills, 'simResults': simResults})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
from fastapi.responses import HTMLResponse
|
14 |
import pandas as pd
|
15 |
from scrape_onet import get_onet_code, get_onet_description, get_onet_tasks
|
16 |
+
from match_utils import neighborhoods, get_resume, skillNER, sim_result_loop, get_links
|
17 |
import time
|
18 |
|
19 |
# APP SETUP
|
|
|
66 |
skills = await skillNER(resume)
|
67 |
simResults = await sim_result_loop(resume)
|
68 |
print(time.time() - t)
|
69 |
+
return templates.TemplateResponse('find_my_match.html', context={'request': request, 'resume': resume, 'skills': skills, 'simResults': simResults})
|
70 |
+
|
71 |
+
@app.get("/find-my-hire/", response_class=HTMLResponse)
|
72 |
+
def get_hires(request: Request):
|
73 |
+
return templates.TemplateResponse('candidate_matcher.html', context={'request': request})
|
74 |
+
|
75 |
+
# POST
|
76 |
+
@app.post('/find-my-hire/', response_class=HTMLResponse)
|
77 |
+
async def post_matches(request: Request, jobdesc: UploadFile = File(...)):
|
78 |
+
t = time.time()
|
79 |
+
jobdesc = get_resume(jobdesc)
|
80 |
+
skills = await skillNER(jobdesc)
|
81 |
+
simResults = await sim_result_loop(jobdesc)
|
82 |
+
links = get_links(simResults)
|
83 |
+
print(time.time() - t)
|
84 |
+
print(links)
|
85 |
+
return templates.TemplateResponse('candidate_matcher.html', context={'request': request, 'jobdesc': jobdesc, 'skills': skills, 'simResults': simResults, 'links': links})
|
86 |
+
|
87 |
+
@app.get("/find-hire/", response_class=HTMLResponse)
|
88 |
+
def find_hire(request: Request):
|
89 |
+
return templates.TemplateResponse('find_hire.html', context={'request': request})
|
match_utils.py
CHANGED
@@ -13,6 +13,7 @@ from numpy.linalg import norm
|
|
13 |
import ssl
|
14 |
from dotenv import load_dotenv
|
15 |
import plotly_express as px
|
|
|
16 |
|
17 |
# SSL CERTIFICATE FIX
|
18 |
try:
|
@@ -109,4 +110,10 @@ async def skillNER(resume):
|
|
109 |
resume = [word for word in resume if "(" not in word]
|
110 |
skills = {}
|
111 |
[skills.update({word : "Skill"}) if classifier(word)[0]['label'] == 'LABEL_1' else skills.update({word: "Not Skill"}) for word in resume]
|
112 |
-
return skills
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
import ssl
|
14 |
from dotenv import load_dotenv
|
15 |
import plotly_express as px
|
16 |
+
from scrape_onet import get_onet_code
|
17 |
|
18 |
# SSL CERTIFICATE FIX
|
19 |
try:
|
|
|
110 |
resume = [word for word in resume if "(" not in word]
|
111 |
skills = {}
|
112 |
[skills.update({word : "Skill"}) if classifier(word)[0]['label'] == 'LABEL_1' else skills.update({word: "Not Skill"}) for word in resume]
|
113 |
+
return skills
|
114 |
+
|
115 |
+
def get_links(simResults):
|
116 |
+
links = []
|
117 |
+
titles = simResults["JobTitle"]
|
118 |
+
[links.append("https://www.onetonline.org/link/summary/" + get_onet_code(title)) for title in titles]
|
119 |
+
return links
|
static/styles.css
CHANGED
@@ -118,6 +118,19 @@ html {
|
|
118 |
text-align:center;
|
119 |
}
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
.upload {
|
122 |
max-width: fit-content;
|
123 |
display: flex;
|
@@ -211,6 +224,13 @@ html {
|
|
211 |
font-weight: bold;
|
212 |
}
|
213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
.footer {
|
215 |
background-color: #323f43;
|
216 |
padding: 40px 0;
|
|
|
118 |
text-align:center;
|
119 |
}
|
120 |
|
121 |
+
.radio__submit {
|
122 |
+
margin: auto;
|
123 |
+
background-color: #3cd0ff;
|
124 |
+
border: none;
|
125 |
+
max-width: fit-content;
|
126 |
+
font-size: 16px;
|
127 |
+
font-weight: bold;
|
128 |
+
padding: 5px 30px;
|
129 |
+
border-radius: 20px;
|
130 |
+
color: white;
|
131 |
+
cursor: pointer;
|
132 |
+
}
|
133 |
+
|
134 |
.upload {
|
135 |
max-width: fit-content;
|
136 |
display: flex;
|
|
|
224 |
font-weight: bold;
|
225 |
}
|
226 |
|
227 |
+
.output__table-item {
|
228 |
+
font-size: 14px;
|
229 |
+
color: #2c2161;
|
230 |
+
margin-bottom: 10px;
|
231 |
+
margin-right: 10px;
|
232 |
+
text-align: left;
|
233 |
+
}
|
234 |
.footer {
|
235 |
background-color: #323f43;
|
236 |
padding: 40px 0;
|
templates/candidate_matcher.html
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
+
<title>Dashboard</title>
|
8 |
+
<link rel="stylesheet" href="/static/styles.css">
|
9 |
+
</head>
|
10 |
+
<body>
|
11 |
+
<header class="navbar">
|
12 |
+
<div class="navbar__brand">
|
13 |
+
<img src="/static/PF.png" class="navbar__logo" alt="Pathfinder logo" />
|
14 |
+
<a href="/" class="navbar__logo">Pathfinder</a>
|
15 |
+
</div>
|
16 |
+
<ul class="navbar__navigation">
|
17 |
+
<li class="navbar__navigation-item"><a href="/explore-job-neighborhoods/" class="navbar__link">Explore Job Neighborhoods</a></li>
|
18 |
+
<li class="navbar__navigation-item"><a href="/find-my-match/" class="navbar__link">Find My Match</a></li>
|
19 |
+
<li class="navbar__navigation-item"><a href="/find-my-hire/" class="navbar__link">Find My Next Hire</a></li>
|
20 |
+
</ul>
|
21 |
+
</header>
|
22 |
+
<main class="main">
|
23 |
+
<h1 class="pagetitle">Find my Next Hire!</h1>
|
24 |
+
<h2 class="pagesubtitle">We'll match the perfect candidate to your role! Upload your job description to get started!</h2>
|
25 |
+
<form class="upload" method="POST" enctype="multipart/form-data">
|
26 |
+
<input type="file" name="jobdesc" id="jobdesc" class="upload__file">
|
27 |
+
<button type="submit" class="form__submit">Submit</button>
|
28 |
+
<p class="alert">Note: This can take a while. Please be patient.</p>
|
29 |
+
</form>
|
30 |
+
<section class="output">
|
31 |
+
{% if jobdesc %}
|
32 |
+
<article class="output__section">
|
33 |
+
<h2 class="output__subtitle">Extracted Skills</h3>
|
34 |
+
<ul>
|
35 |
+
{% for word in jobdesc.lower().replace("-"," ").replace(")","").replace("(","").replace(":","").replace(",","").replace("/"," ").split(" ") %}
|
36 |
+
{% if skills.get(word) == "Skill" %}
|
37 |
+
<span class="output__list-coloreditem">{{ word }}</span>
|
38 |
+
{% else %}
|
39 |
+
<span class="output__list-item">{{ word }}</span>
|
40 |
+
{% endif %}
|
41 |
+
{% endfor %}
|
42 |
+
</ul>
|
43 |
+
</article>
|
44 |
+
<article class="output__section">
|
45 |
+
<h2 class="output__subtitle">We Think Your Job Description Most Closely Matches these Roles</h3>
|
46 |
+
<p class="alert">Click on the links to find out more. When you have decided which job title is most closely aligned with your job description, click "Submit."</p>
|
47 |
+
<form action="/find-hire/" method="GET">
|
48 |
+
<table>
|
49 |
+
<thead class="output__list">
|
50 |
+
<tr>
|
51 |
+
<th class="output__list-coloreditem">Job Title</th>
|
52 |
+
<th class="output__list-coloreditem" scope="col">Match Score</th>
|
53 |
+
</tr>
|
54 |
+
</thead>
|
55 |
+
<tbody class="output__table"></tbody>
|
56 |
+
{% for n in range(1,11) %}
|
57 |
+
<tr>
|
58 |
+
<th class="output__list-item" scope="row">
|
59 |
+
<input type="radio" id="jobselection" name="jobselection" value={{ simResults.loc[n, 'JobTitle'] }}>
|
60 |
+
<a class="output__table-item" href={{ links[n] }}>{{ simResults.loc[n, 'JobTitle'] }}</a>
|
61 |
+
</th>
|
62 |
+
<td class="output__list-item">
|
63 |
+
{{ simResults.loc[n, 'Similarity'] }}
|
64 |
+
</td>
|
65 |
+
</tr>
|
66 |
+
{% endfor %}
|
67 |
+
</tbody>
|
68 |
+
</table>
|
69 |
+
<br>
|
70 |
+
<div class="radio__submit">
|
71 |
+
<button type="submit" class="radio__submit">Submit</button>
|
72 |
+
</div>
|
73 |
+
</form>
|
74 |
+
</article>
|
75 |
+
{% endif %}
|
76 |
+
</section>
|
77 |
+
</main>
|
78 |
+
<footer class="footer">
|
79 |
+
<ul class="footer__text">
|
80 |
+
<li class="footer__text-item">© 2023 Pathfinder</li>
|
81 |
+
<li class="footer__text-item">For details on the finetuned distilbert model being used in this step, please see: <a class="footer__text-link" href="https://www.github.com/celise88/Pathfinder">github.com/celise88/Pathfinder</li>
|
82 |
+
</ul>
|
83 |
+
</footer>
|
84 |
+
</body>
|
85 |
+
</html>
|
templates/find_hire.html
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
+
<title>Dashboard</title>
|
8 |
+
<link rel="stylesheet" href="/static/styles.css">
|
9 |
+
</head>
|
10 |
+
<body>
|
11 |
+
<header class="navbar">
|
12 |
+
<div class="navbar__brand">
|
13 |
+
<img src="/static/PF.png" class="navbar__logo" alt="Pathfinder logo" />
|
14 |
+
<a href="/" class="navbar__logo">Pathfinder</a>
|
15 |
+
</div>
|
16 |
+
<ul class="navbar__navigation">
|
17 |
+
<li class="navbar__navigation-item"><a href="/explore-job-neighborhoods/" class="navbar__link">Explore Job Neighborhoods</a></li>
|
18 |
+
<li class="navbar__navigation-item"><a href="/find-my-match/" class="navbar__link">Find My Match</a></li>
|
19 |
+
<li class="navbar__navigation-item"><a href="/find-my-hire/" class="navbar__link">Find My Next Hire</a></li>
|
20 |
+
</ul>
|
21 |
+
</header>
|
22 |
+
<main class="main">
|
23 |
+
<h1 class="pagetitle">Under Construction</h1>
|
24 |
+
<h2 class="pagesubtitle">We're sorry! This page is currently under construction. Please check back soon!</h2>
|
25 |
+
</main>
|
26 |
+
<footer class="footer">
|
27 |
+
<ul class="footer__text">
|
28 |
+
<li class="footer__text-item">© 2023 Pathfinder</li>
|
29 |
+
</ul>
|
30 |
+
</footer>
|
31 |
+
</body>
|
32 |
+
</html>
|
templates/find_my_match.html
CHANGED
@@ -16,6 +16,7 @@
|
|
16 |
<ul class="navbar__navigation">
|
17 |
<li class="navbar__navigation-item"><a href="/explore-job-neighborhoods/" class="navbar__link">Explore Job Neighborhoods</a></li>
|
18 |
<li class="navbar__navigation-item"><a href="/find-my-match/" class="navbar__link">Find My Match</a></li>
|
|
|
19 |
</ul>
|
20 |
</header>
|
21 |
<main class="main">
|
|
|
16 |
<ul class="navbar__navigation">
|
17 |
<li class="navbar__navigation-item"><a href="/explore-job-neighborhoods/" class="navbar__link">Explore Job Neighborhoods</a></li>
|
18 |
<li class="navbar__navigation-item"><a href="/find-my-match/" class="navbar__link">Find My Match</a></li>
|
19 |
+
<li class="navbar__navigation-item"><a href="/find-my-hire/" class="navbar__link">Find My Next Hire</a></li>
|
20 |
</ul>
|
21 |
</header>
|
22 |
<main class="main">
|
templates/job_list.html
CHANGED
@@ -16,6 +16,7 @@
|
|
16 |
<ul class="navbar__navigation">
|
17 |
<li class="navbar__navigation-item"><a href="/explore-job-neighborhoods/" class="navbar__link">Explore Job Neighborhoods</a></li>
|
18 |
<li class="navbar__navigation-item"><a href="/find-my-match/" class="navbar__link">Find My Match</a></li>
|
|
|
19 |
</ul>
|
20 |
</header>
|
21 |
<main class="main">
|
|
|
16 |
<ul class="navbar__navigation">
|
17 |
<li class="navbar__navigation-item"><a href="/explore-job-neighborhoods/" class="navbar__link">Explore Job Neighborhoods</a></li>
|
18 |
<li class="navbar__navigation-item"><a href="/find-my-match/" class="navbar__link">Find My Match</a></li>
|
19 |
+
<li class="navbar__navigation-item"><a href="/find-my-hire/" class="navbar__link">Find My Next Hire</a></li>
|
20 |
</ul>
|
21 |
</header>
|
22 |
<main class="main">
|