david-thrower commited on
Commit
a77ecf2
·
1 Parent(s): e7d0d5d

Checkpoint that includes all fields. Need to add confirmation.

Browse files
Files changed (1) hide show
  1. app.py +29 -84
app.py CHANGED
@@ -142,6 +142,8 @@ def get_key_accomplishments_prompt(job_and_company_info, resume):
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:
146
  def __init__(self, company_name, company_url, job_description, clean_job_description, job_title):
147
  self.company_name = company_name
@@ -169,7 +171,7 @@ def smol_lm_jd_process(job_description, system_prompt, max_new_tokens=512):
169
  response = response[start_idx + len("<|im_start|>assistant\n"):end_idx].strip()
170
  return response
171
 
172
- def process_job_description(company_name, company_url, job_description):
173
 
174
  # Step 2: Extract key qualifications, skills, and requirements
175
  system_prompt_requirements = "Extract key qualifications, skills, and requirements from this job description. Output as bullet points. Remove benefits/salary, bragging about the company, and other fluff not relevant to the skills, qualifications, and job requirements. ONLY INCLUDE INFORMATION THAT TELLS THE USER WHAT SKILLS THE EMPLOYER SEEKS."
@@ -242,109 +244,52 @@ def process_job_description(company_name, company_url, job_description):
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']}
251
- Job Title: {job_and_company_info['job_title']}
252
- Role Requirements: {job_and_company_info['Role Requirements']}
253
- Clean Job Description: {job_and_company_info['Clean Job Description']}
254
- Company Research:
255
- Company Values: {job_and_company_info['Company Research']['Company Values Summary']}
256
- Corporate Culture: {job_and_company_info['Company Research']['Corporate Culture Summary']}
257
- Leadership Team and Possible Key Opinion Leaders: {job_and_company_info['Company Research']['Leadership Team Summary']}
258
- Recent Company News: {job_and_company_info['Company Research']['Recent News Summary']}
259
- Company Competitive Advantages: {job_and_company_info['Company Research']['Competitive Advantages Summary']}
260
- """
261
-
262
- prompt = GAP_ASSESSMENT_PROMPT.replace("{JOB_AND_COMPANY_INFO}", job_and_company_info_str).replace("{RESUME}", resume)
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
 
287
  with demo:
288
- gr.Markdown("# Job Description Input")
289
- company_name = gr.Textbox(label="Company Name")
290
- company_url = gr.Textbox(label="Company URL")
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__":
 
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
+ return key_skills_and_accomplaishments
146
+
147
  class Role:
148
  def __init__(self, company_name, company_url, job_description, clean_job_description, job_title):
149
  self.company_name = company_name
 
171
  response = response[start_idx + len("<|im_start|>assistant\n"):end_idx].strip()
172
  return response
173
 
174
+ def process_job_description(company_name, company_url, job_description, resume):
175
 
176
  # Step 2: Extract key qualifications, skills, and requirements
177
  system_prompt_requirements = "Extract key qualifications, skills, and requirements from this job description. Output as bullet points. Remove benefits/salary, bragging about the company, and other fluff not relevant to the skills, qualifications, and job requirements. ONLY INCLUDE INFORMATION THAT TELLS THE USER WHAT SKILLS THE EMPLOYER SEEKS."
 
244
  }
245
  }
246
 
247
+ gap_assessment_prompt = get_gap_assessment_prompt(job_and_company_info, resume)
248
+ return job_and_company_info, role, gap_assessment_prompt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
 
250
+ def generate_key_accomplishments_and_skills_prompt(job_and_company_info, resume):
251
+ return get_key_accomplishments_prompt(job_and_company_info, resume)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
 
253
  # Create the Gradio app
254
  demo = gr.Blocks()
255
 
256
  with demo:
257
+ gr.Markdown("# Job Description and Resume Input")
258
+ with gr.Row():
259
+ company_name = gr.Textbox(label="Company Name")
260
+ company_url = gr.Textbox(label="Company URL")
261
+ job_description = gr.TextArea(label="Paste Job Description")
262
+ resume = gr.TextArea(label="Paste Resume")
263
 
264
  job_and_company_info_output = gr.JSON(label="Job and Company Info")
265
  role_output = gr.State()
266
+ gap_assessment_prompt_output = gr.TextArea(label="Gap Assessment Prompt")
267
 
268
  gr.Button("Submit").click(
269
  process_job_description,
270
+ inputs=[company_name, company_url, job_description, resume],
271
+ outputs=[job_and_company_info_output, role_output, gap_assessment_prompt_output]
272
  )
273
 
274
+ gap_assessment_result = gr.TextArea(label="Paste Gap Assessment Result")
275
+ gr.Button("Submit Gap Assessment Result").click(
276
+ None,
277
+ inputs=[gap_assessment_result],
278
+ outputs=None
279
+ )
280
 
281
+ key_accomplishments_and_skills_prompt_output = gr.TextArea(label="Key Accomplishments and Skills Prompt")
282
+ gr.Button("Generate Key Accomplishments and Skills Prompt").click(
283
+ generate_key_accomplishments_and_skills_prompt,
 
 
 
284
  inputs=[job_and_company_info_output, resume],
285
  outputs=key_accomplishments_and_skills_prompt_output
 
 
 
286
  )
287
 
288
+ key_accomplishments_and_skills_result = gr.TextArea(label="Paste Key Accomplishments and Skills Result")
289
+ gr.Button("Submit Key Accomplishments and Skills Result").click(
290
+ None,
 
 
 
 
 
 
 
 
 
291
  inputs=[key_accomplishments_and_skills_result],
292
+ outputs=None
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  )
294
 
295
  if __name__ == "__main__":