david-thrower commited on
Commit
e40dd00
·
verified ·
1 Parent(s): a2ee549

Update app.py

Browse files

Automated previously manual steps.

Files changed (1) hide show
  1. app.py +62 -60
app.py CHANGED
@@ -543,6 +543,7 @@ def generate_resume_prompt(job_and_company_info, resume, gap_assessment_result_o
543
  # Create the Gradio app
544
  demo = gr.Blocks()
545
 
 
546
  with demo:
547
  gr.Markdown("# Job Description and Resume Input")
548
  with gr.Row():
@@ -551,82 +552,83 @@ with demo:
551
  job_description = gr.TextArea(label="Paste Job Description")
552
  resume = gr.TextArea(label="Paste Resume")
553
 
554
- job_and_company_info_output = gr.State()
555
- role_output = gr.State()
556
- gap_assessment_prompt_output = gr.TextArea(label="Gap Assessment Prompt")
 
 
 
 
557
 
558
- gr.Button("Submit").click(
559
- process_job_description,
560
- inputs=[company_name, company_url, job_description, resume],
561
- outputs=[job_and_company_info_output, role_output, gap_assessment_prompt_output]
562
- )
563
 
564
- gr.Markdown("## Gap Assessment")
565
- gap_assessment_result = gr.TextArea(label="Paste Gap Assessment Result")
566
- key_accomplishments_and_skills_prompt_output = gr.TextArea(label="Key Accomplishments and Skills Prompt", interactive=False)
567
 
568
- gr.Button("Submit Gap Assessment Result").click(
569
- lambda x: x,
570
- inputs=[gap_assessment_result],
 
 
571
  ).then(
572
- generate_key_accomplishments_and_skills_prompt,
573
- inputs=[job_and_company_info_output, resume],
574
- outputs=key_accomplishments_and_skills_prompt_output
575
- )
576
-
577
- gr.Markdown("## Key Accomplishments and Skills")
578
- key_accomplishments_and_skills_result = gr.TextArea(label="Paste Key Accomplishments and Skills Result")
579
- resume_prompt_output = gr.TextArea(label="Resume Prompt")
580
-
581
- gr.Button("Submit Key Accomplishments and Skills Result").click(
582
- lambda x: x,
583
- inputs=[key_accomplishments_and_skills_result],
584
  ).then(
585
- generate_resume_prompt,
586
- inputs=[job_and_company_info_output, resume, gap_assessment_result, key_accomplishments_and_skills_result],
587
- outputs=resume_prompt_output
588
- )
589
-
590
- gr.Markdown("## Resume Prompt")
591
- customized_resume = gr.TextArea(label="Paste In Final Resume")
592
- gr.Button("Submit Customized Resume").click(
593
- lambda job_and_company_info, customized_resume: f"""
594
-
 
 
 
 
 
 
 
 
 
 
 
595
  # Write a 3-paragraph cover letter with:
596
- 1. Personalized greeting (use {job_and_company_info['Company Research']['Leadership Team Summary']} if available)
597
  2. Opening paragraph: Role you're applying for and excitement
598
  3. Body: Match a few of the top qualifications to job requirements
599
  4. Consider this company research and company metadata as you are writing this:
600
-
601
- Company Name: {job_and_company_info['Company Name']}
602
- Company URL: {job_and_company_info['Company URL']}
603
- Job Title: {job_and_company_info['job_title']}
604
- Role Requirements: {job_and_company_info['Role Requirements']}
605
- Clean Job Description: {job_and_company_info['Clean Job Description']}
606
  Company Research:
607
- Company Values: {job_and_company_info['Company Research']['Company Values Summary']}
608
- Corporate Culture: {job_and_company_info['Company Research']['Corporate Culture Summary']}
609
- Leadership Team and Possible Key Opinion Leaders: {job_and_company_info['Company Research']['Leadership Team Summary']}
610
- Recent Company News: {job_and_company_info['Company Research']['Recent News Summary']}
611
- Company Competitive Advantages: {job_and_company_info['Company Research']['Competitive Advantages Summary']}
612
- Company History: {job_and_company_info['Company Research']['Company History Summary']}
613
- Company Mission Statement: {job_and_company_info['Company Research']['Mission Statement Summary']}
614
- Company Investor Relations Info: {job_and_company_info['Company Research']['Investor Relations Summary']}
615
- Summary of Info Gathered From Company Social Media: {job_and_company_info['Company Research']["Social Media Summary"]}
616
-
617
-
618
  5. Closing: Express reasonable enthusiasm and request discussion. Don't overdo it and make the enthusiasm not sound feigned or disingenuous.
619
-
620
  ## This is the resume for this job to consider in writing this:
621
-
622
  {customized_resume}
623
-
624
  """,
625
- inputs=[job_and_company_info_output, customized_resume],
626
- outputs=gr.TextArea(label="Cover Letter Prompt")
627
  )
628
 
629
- gr.Markdown("Copy the following prompt into a suitable SOTA AI assistant like LLama 4 maveric on poe.com, Deepseek R1-1776 on poe.com, Qwen/Qwen3-235B-A22B on huggingface chat, or chatGPT. Save the result as a Word document, then export it to PDF. You now have a resume and cover letter ready to submit.")
 
 
630
 
631
  if __name__ == "__main__":
632
  demo.launch()
 
543
  # Create the Gradio app
544
  demo = gr.Blocks()
545
 
546
+
547
  with demo:
548
  gr.Markdown("# Job Description and Resume Input")
549
  with gr.Row():
 
552
  job_description = gr.TextArea(label="Paste Job Description")
553
  resume = gr.TextArea(label="Paste Resume")
554
 
555
+ # Intermediate State Components
556
+ job_info_state = gr.State()
557
+ gap_prompt_state = gr.State()
558
+ gap_result_state = gr.State()
559
+ key_prompt_state = gr.State()
560
+ key_result_state = gr.State()
561
+ resume_prompt_state = gr.State()
562
 
563
+ gr.Markdown("## Generated Resume and Cover Letter")
564
+ customized_resume = gr.TextArea(label="Generated Resume")
565
+ cover_letter_prompt = gr.TextArea(label="Cover Letter Prompt")
 
 
566
 
567
+ submit_btn = gr.Button("Submit")
 
 
568
 
569
+ # Step 1: Process job description and generate gap assessment prompt
570
+ submit_btn.click(
571
+ fn=process_job_description,
572
+ inputs=[company_name, company_url, job_description, resume],
573
+ outputs=[job_info_state, gr.State(), gap_prompt_state]
574
  ).then(
575
+ # Step 2: Send gap assessment prompt to Smollm3-3B
576
+ fn=smol_writing_task,
577
+ inputs=gap_prompt_state,
578
+ outputs=gap_result_state
 
 
 
 
 
 
 
 
579
  ).then(
580
+ # Step 3: Generate key accomplishments prompt
581
+ fn=generate_key_accomplishments_and_skills_prompt,
582
+ inputs=[job_info_state, resume],
583
+ outputs=key_prompt_state
584
+ ).then(
585
+ # Step 4: Send key accomplishments prompt to Smollm3-3B
586
+ fn=smol_writing_task,
587
+ inputs=key_prompt_state,
588
+ outputs=key_result_state
589
+ ).then(
590
+ # Step 5: Generate resume prompt using results and send to Qwen3
591
+ fn=get_resume_prompt,
592
+ inputs=[job_info_state, resume, gap_result_state, key_result_state],
593
+ outputs=resume_prompt_state
594
+ ).then(
595
+ fn=writing_task,
596
+ inputs=resume_prompt_state,
597
+ outputs=customized_resume
598
+ ).then(
599
+ # Step 6: Generate cover letter prompt (user still needs to run this manually)
600
+ fn=lambda job_info, customized_resume: f"""
601
  # Write a 3-paragraph cover letter with:
602
+ 1. Personalized greeting (use {job_info['Company Research']['Leadership Team Summary']} if available)
603
  2. Opening paragraph: Role you're applying for and excitement
604
  3. Body: Match a few of the top qualifications to job requirements
605
  4. Consider this company research and company metadata as you are writing this:
606
+ Company Name: {job_info['Company Name']}
607
+ Company URL: {job_info['Company URL']}
608
+ Job Title: {job_info['job_title']}
609
+ Role Requirements: {job_info['Role Requirements']}
610
+ Clean Job Description: {job_info['Clean Job Description']}
 
611
  Company Research:
612
+ Company Values: {job_info['Company Research']['Company Values Summary']}
613
+ Corporate Culture: {job_info['Company Research']['Corporate Culture Summary']}
614
+ Leadership Team and Possible Key Opinion Leaders: {job_info['Company Research']['Leadership Team Summary']}
615
+ Recent Company News: {job_info['Company Research']['Recent News Summary']}
616
+ Company Competitive Advantages: {job_info['Company Research']['Competitive Advantages Summary']}
617
+ Company History: {job_info['Company Research']['Company History Summary']}
618
+ Company Mission Statement: {job_info['Company Research']['Mission Statement Summary']}
619
+ Company Investor Relations Info: {job_info['Company Research']['Investor Relations Summary']}
620
+ Summary of Info Gathered From Company Social Media: {job_info['Company Research']["Social Media Summary"]}
 
 
621
  5. Closing: Express reasonable enthusiasm and request discussion. Don't overdo it and make the enthusiasm not sound feigned or disingenuous.
 
622
  ## This is the resume for this job to consider in writing this:
 
623
  {customized_resume}
 
624
  """,
625
+ inputs=[job_info_state, customized_resume],
626
+ outputs=cover_letter_prompt
627
  )
628
 
629
+
630
+
631
+
632
 
633
  if __name__ == "__main__":
634
  demo.launch()