Update app.py
Browse filesAutomated previously manual steps.
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 |
-
|
| 555 |
-
|
| 556 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 557 |
|
| 558 |
-
gr.
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
outputs=[job_and_company_info_output, role_output, gap_assessment_prompt_output]
|
| 562 |
-
)
|
| 563 |
|
| 564 |
-
gr.
|
| 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 |
-
|
| 569 |
-
|
| 570 |
-
|
|
|
|
|
|
|
| 571 |
).then(
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 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 |
-
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
|
| 591 |
-
|
| 592 |
-
|
| 593 |
-
|
| 594 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 595 |
# Write a 3-paragraph cover letter with:
|
| 596 |
-
1. Personalized greeting (use {
|
| 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
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
Clean Job Description: {job_and_company_info['Clean Job Description']}
|
| 606 |
Company Research:
|
| 607 |
-
Company Values: {
|
| 608 |
-
Corporate Culture: {
|
| 609 |
-
Leadership Team and Possible Key Opinion Leaders: {
|
| 610 |
-
Recent Company News: {
|
| 611 |
-
Company Competitive Advantages: {
|
| 612 |
-
Company History: {
|
| 613 |
-
Company Mission Statement: {
|
| 614 |
-
Company Investor Relations Info: {
|
| 615 |
-
Summary of Info Gathered From Company Social Media: {
|
| 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=[
|
| 626 |
-
outputs=
|
| 627 |
)
|
| 628 |
|
| 629 |
-
|
|
|
|
|
|
|
| 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()
|