Commit
·
e7d0d5d
1
Parent(s):
1b088ec
Checkpoint that includes the prompt templates for this task.
Browse files
app.py
CHANGED
|
@@ -12,7 +12,8 @@ tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
| 12 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 13 |
model.to(device)
|
| 14 |
|
| 15 |
-
|
|
|
|
| 16 |
|
| 17 |
# Do a gap assessment on this job role and resume looking for gaps that can be overcome by strategy in writing the resume and cover letter. For each gap, include a strategy for remediation. Ignore and do not mention any gap that is structural and for which improved writing will not be helpful. Consider things like:
|
| 18 |
|
|
@@ -91,15 +92,54 @@ Remediation Strategies: Briefly explain significant gaps in the cover letter, fr
|
|
| 91 |
|
| 92 |
# This is the role description, company information, and results of company research, and
|
| 93 |
|
| 94 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
|
| 97 |
## This is the candidate's resume:
|
| 98 |
|
| 99 |
-
{
|
| 100 |
|
| 101 |
# For this task, do not re-write their resume. Simply identify any of these described gaps or other potential gaps and strategies in re-writing and re-framing the resume which are likely to be effective in improving the odds of being offered an interview or job.
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
"""
|
| 104 |
|
| 105 |
class Role:
|
|
@@ -110,6 +150,10 @@ class Role:
|
|
| 110 |
self.clean_job_description = clean_job_description
|
| 111 |
self.job_title = job_title
|
| 112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
def smol_lm_jd_process(job_description, system_prompt, max_new_tokens=512):
|
| 114 |
prompt = f"""<|im_start|>system
|
| 115 |
{system_prompt}<|im_end|>
|
|
@@ -198,9 +242,9 @@ def process_job_description(company_name, company_url, job_description):
|
|
| 198 |
}
|
| 199 |
}
|
| 200 |
|
| 201 |
-
return job_and_company_info
|
| 202 |
|
| 203 |
-
def generate_gap_assessment_prompt(job_and_company_info, resume):
|
| 204 |
job_and_company_info_str = f"""
|
| 205 |
Company Name: {job_and_company_info['Company Name']}
|
| 206 |
Company URL: {job_and_company_info['Company URL']}
|
|
@@ -219,13 +263,24 @@ def generate_gap_assessment_prompt(job_and_company_info, resume):
|
|
| 219 |
|
| 220 |
return prompt
|
| 221 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
def gap_assessment_interface(job_and_company_info, resume):
|
| 223 |
-
prompt =
|
| 224 |
return gr.TextArea(label="Gap Assessment Prompt", value=prompt, interactive=False)
|
| 225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
def submit_gap_assessment_result(gap_assessment_result):
|
| 227 |
return gap_assessment_result
|
| 228 |
|
|
|
|
|
|
|
|
|
|
| 229 |
# Create the Gradio app
|
| 230 |
demo = gr.Blocks()
|
| 231 |
|
|
@@ -236,33 +291,62 @@ with demo:
|
|
| 236 |
job_description = gr.TextArea(label="Paste Job Description")
|
| 237 |
|
| 238 |
job_and_company_info_output = gr.JSON(label="Job and Company Info")
|
|
|
|
| 239 |
|
| 240 |
gr.Button("Submit").click(
|
| 241 |
process_job_description,
|
| 242 |
inputs=[company_name, company_url, job_description],
|
| 243 |
-
outputs=job_and_company_info_output
|
| 244 |
)
|
| 245 |
|
| 246 |
gr.Markdown("# Resume Input")
|
| 247 |
resume = gr.TextArea(label="Paste Resume")
|
| 248 |
|
| 249 |
-
gap_assessment_prompt_output = gr.TextArea(label="Gap Assessment Prompt")
|
|
|
|
| 250 |
|
| 251 |
-
gr.Button("Generate
|
| 252 |
gap_assessment_interface,
|
| 253 |
inputs=[job_and_company_info_output, resume],
|
| 254 |
outputs=gap_assessment_prompt_output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
)
|
| 256 |
|
| 257 |
-
gr.Markdown("# Gap Assessment Result")
|
| 258 |
-
gap_assessment_result = gr.TextArea(label="Paste Gap Assessment Result")
|
| 259 |
-
|
| 260 |
-
gr.Button("Submit Gap Assessment Result").click(
|
| 261 |
submit_gap_assessment_result,
|
| 262 |
inputs=[gap_assessment_result],
|
| 263 |
outputs=gr.TextArea(label="Gap Assessment Result")
|
| 264 |
)
|
| 265 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
if __name__ == "__main__":
|
| 267 |
demo.launch()
|
| 268 |
|
|
|
|
| 12 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 13 |
model.to(device)
|
| 14 |
|
| 15 |
+
def get_gap_assessment_prompt(job_and_company_info, resume):
|
| 16 |
+
gap_assessment_prompt = f"""
|
| 17 |
|
| 18 |
# Do a gap assessment on this job role and resume looking for gaps that can be overcome by strategy in writing the resume and cover letter. For each gap, include a strategy for remediation. Ignore and do not mention any gap that is structural and for which improved writing will not be helpful. Consider things like:
|
| 19 |
|
|
|
|
| 92 |
|
| 93 |
# This is the role description, company information, and results of company research, and
|
| 94 |
|
| 95 |
+
Company Name: {job_and_company_info['Company Name']}
|
| 96 |
+
Company URL: {job_and_company_info['Company URL']}
|
| 97 |
+
Job Title: {job_and_company_info['job_title']}
|
| 98 |
+
Role Requirements: {job_and_company_info['Role Requirements']}
|
| 99 |
+
Clean Job Description: {job_and_company_info['Clean Job Description']}
|
| 100 |
+
Company Research:
|
| 101 |
+
Company Values: {job_and_company_info['Company Research']['Company Values Summary']}
|
| 102 |
+
Corporate Culture: {job_and_company_info['Company Research']['Corporate Culture Summary']}
|
| 103 |
+
Leadership Team and Possible Key Opinion Leaders: {job_and_company_info['Company Research']['Leadership Team Summary']}
|
| 104 |
+
Recent Company News: {job_and_company_info['Company Research']['Recent News Summary']}
|
| 105 |
+
Company Competitive Advantages: {job_and_company_info['Company Research']['Competitive Advantages Summary']}
|
| 106 |
|
| 107 |
|
| 108 |
## This is the candidate's resume:
|
| 109 |
|
| 110 |
+
{resume}
|
| 111 |
|
| 112 |
# For this task, do not re-write their resume. Simply identify any of these described gaps or other potential gaps and strategies in re-writing and re-framing the resume which are likely to be effective in improving the odds of being offered an interview or job.
|
| 113 |
|
| 114 |
+
"""
|
| 115 |
+
return gap_assessment_prompt
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
def get_key_accomplishments_prompt(job_and_company_info, resume):
|
| 119 |
+
|
| 120 |
+
key_skills_and_accomplaishments = f"""
|
| 121 |
+
# Extract relevant 1. 1-5 key accomplishments accomplishments and 2. all transferable skills from the applicant's resume that aligns with the job description.
|
| 122 |
+
|
| 123 |
+
# This is the role description, company information, and results of company research, and
|
| 124 |
+
|
| 125 |
+
Company Name: {job_and_company_info['Company Name']}
|
| 126 |
+
Company URL: {job_and_company_info['Company URL']}
|
| 127 |
+
Job Title: {job_and_company_info['job_title']}
|
| 128 |
+
Role Requirements: {job_and_company_info['Role Requirements']}
|
| 129 |
+
Clean Job Description: {job_and_company_info['Clean Job Description']}
|
| 130 |
+
Company Research:
|
| 131 |
+
Company Values: {job_and_company_info['Company Research']['Company Values Summary']}
|
| 132 |
+
Corporate Culture: {job_and_company_info['Company Research']['Corporate Culture Summary']}
|
| 133 |
+
Leadership Team and Possible Key Opinion Leaders: {job_and_company_info['Company Research']['Leadership Team Summary']}
|
| 134 |
+
Recent Company News: {job_and_company_info['Company Research']['Recent News Summary']}
|
| 135 |
+
Company Competitive Advantages: {job_and_company_info['Company Research']['Competitive Advantages Summary']}
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
## This is the candidate's resume:
|
| 139 |
+
|
| 140 |
+
{resume}
|
| 141 |
+
|
| 142 |
+
Please provide the following information in a concise and straightforward manner, without any extraneous comments or information that may confuse an LLM that this response will be piped to: Output the results in a simple format, with the key accomplishments first, followed by the transferable skills."
|
| 143 |
"""
|
| 144 |
|
| 145 |
class Role:
|
|
|
|
| 150 |
self.clean_job_description = clean_job_description
|
| 151 |
self.job_title = job_title
|
| 152 |
|
| 153 |
+
class Applicant:
|
| 154 |
+
def __init__(self, resume):
|
| 155 |
+
self.resume = resume
|
| 156 |
+
|
| 157 |
def smol_lm_jd_process(job_description, system_prompt, max_new_tokens=512):
|
| 158 |
prompt = f"""<|im_start|>system
|
| 159 |
{system_prompt}<|im_end|>
|
|
|
|
| 242 |
}
|
| 243 |
}
|
| 244 |
|
| 245 |
+
return job_and_company_info, role
|
| 246 |
|
| 247 |
+
def generate_gap_assessment_prompt(job_and_company_info, resume, role):
|
| 248 |
job_and_company_info_str = f"""
|
| 249 |
Company Name: {job_and_company_info['Company Name']}
|
| 250 |
Company URL: {job_and_company_info['Company URL']}
|
|
|
|
| 263 |
|
| 264 |
return prompt
|
| 265 |
|
| 266 |
+
def generate_key_accomplishments_and_skills_prompt(role, applicant):
|
| 267 |
+
prompt = KEY_ACCOMPLISHMENTS_AND_SKILLS.replace("{Role.clean_job_description}", role.clean_job_description).replace("{Applicant.resume}", applicant.resume)
|
| 268 |
+
return prompt
|
| 269 |
+
|
| 270 |
def gap_assessment_interface(job_and_company_info, resume):
|
| 271 |
+
prompt = get_gap_assessment_prompt(job_and_company_info, resume)
|
| 272 |
return gr.TextArea(label="Gap Assessment Prompt", value=prompt, interactive=False)
|
| 273 |
|
| 274 |
+
def key_accomplishments_and_skills_interface(job_and_company_info, resume):
|
| 275 |
+
prompt = get_key_accomplishments_prompt(job_and_company_info, resume)
|
| 276 |
+
return gr.TextArea(label="Key Accomplishments and Skills Prompt", value=prompt, interactive=False)
|
| 277 |
+
|
| 278 |
def submit_gap_assessment_result(gap_assessment_result):
|
| 279 |
return gap_assessment_result
|
| 280 |
|
| 281 |
+
def submit_key_accomplishments_and_skills_result(key_accomplishments_and_skills_result):
|
| 282 |
+
return key_accomplishments_and_skills_result
|
| 283 |
+
|
| 284 |
# Create the Gradio app
|
| 285 |
demo = gr.Blocks()
|
| 286 |
|
|
|
|
| 291 |
job_description = gr.TextArea(label="Paste Job Description")
|
| 292 |
|
| 293 |
job_and_company_info_output = gr.JSON(label="Job and Company Info")
|
| 294 |
+
role_output = gr.State()
|
| 295 |
|
| 296 |
gr.Button("Submit").click(
|
| 297 |
process_job_description,
|
| 298 |
inputs=[company_name, company_url, job_description],
|
| 299 |
+
outputs=[job_and_company_info_output, role_output]
|
| 300 |
)
|
| 301 |
|
| 302 |
gr.Markdown("# Resume Input")
|
| 303 |
resume = gr.TextArea(label="Paste Resume")
|
| 304 |
|
| 305 |
+
gap_assessment_prompt_output = gr.TextArea(label="Gap Assessment Prompt", visible=False)
|
| 306 |
+
key_accomplishments_and_skills_prompt_output = gr.TextArea(label="Key Accomplishments and Skills Prompt", visible=False)
|
| 307 |
|
| 308 |
+
gr.Button("Generate Prompts").click(
|
| 309 |
gap_assessment_interface,
|
| 310 |
inputs=[job_and_company_info_output, resume],
|
| 311 |
outputs=gap_assessment_prompt_output
|
| 312 |
+
).then(
|
| 313 |
+
key_accomplishments_and_skills_interface,
|
| 314 |
+
inputs=[job_and_company_info_output, resume],
|
| 315 |
+
outputs=key_accomplishments_and_skills_prompt_output
|
| 316 |
+
).then(
|
| 317 |
+
lambda: [gr.update(visible=True), gr.update(visible=True)],
|
| 318 |
+
outputs=[gap_assessment_prompt_output, key_accomplishments_and_skills_prompt_output]
|
| 319 |
)
|
| 320 |
|
| 321 |
+
gr.Markdown("# Gap Assessment Result", visible=False)
|
| 322 |
+
gap_assessment_result = gr.TextArea(label="Paste Gap Assessment Result", visible=False)
|
| 323 |
+
gr.Button("Submit Gap Assessment Result", visible=False).click(
|
|
|
|
| 324 |
submit_gap_assessment_result,
|
| 325 |
inputs=[gap_assessment_result],
|
| 326 |
outputs=gr.TextArea(label="Gap Assessment Result")
|
| 327 |
)
|
| 328 |
|
| 329 |
+
gr.Markdown("# Key Accomplishments and Skills Result", visible=False)
|
| 330 |
+
key_accomplishments_and_skills_result = gr.TextArea(label="Paste Key Accomplishments and Skills Result", visible=False)
|
| 331 |
+
gr.Button("Submit Key Accomplishments and Skills Result", visible=False).click(
|
| 332 |
+
submit_key_accomplishments_and_skills_result,
|
| 333 |
+
inputs=[key_accomplishments_and_skills_result],
|
| 334 |
+
outputs=gr.TextArea(label="Key Accomplishments and Skills Result")
|
| 335 |
+
)
|
| 336 |
+
|
| 337 |
+
def show_results():
|
| 338 |
+
return [gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)]
|
| 339 |
+
|
| 340 |
+
gr.Button("Generate Prompts").click(
|
| 341 |
+
show_results,
|
| 342 |
+
outputs=[gr.Markdown("# Gap Assessment Result", visible=False),
|
| 343 |
+
gap_assessment_result,
|
| 344 |
+
gr.Button("Submit Gap Assessment Result", visible=False),
|
| 345 |
+
gr.Markdown("# Key Accomplishments and Skills Result", visible=False),
|
| 346 |
+
key_accomplishments_and_skills_result,
|
| 347 |
+
gr.Button("Submit Key Accomplishments and Skills Result", visible=False)]
|
| 348 |
+
)
|
| 349 |
+
|
| 350 |
if __name__ == "__main__":
|
| 351 |
demo.launch()
|
| 352 |
|