Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -69,7 +69,6 @@ def weighted_score(text):
|
|
| 69 |
return sum(weight for kw, weight in weighted_keywords.items() if kw in text)
|
| 70 |
|
| 71 |
|
| 72 |
-
|
| 73 |
# GPT Job Role Prediction
|
| 74 |
roles = ["AI Engineer", "Data Scientist", "Project Manager", "Sales Executive", "Teacher", "HR Specialist", "Security Officer"]
|
| 75 |
|
|
@@ -643,7 +642,7 @@ textarea[aria-label*="Resume Strength"], textarea[aria-label*="Predicted Job Rol
|
|
| 643 |
tips_output = gr.Markdown("")
|
| 644 |
|
| 645 |
with gr.Column(elem_classes="card"):
|
| 646 |
-
about_input = gr.Textbox(label="LinkedIn About (Optional)", lines=3)
|
| 647 |
linkedin_btn = gr.Button("β¨ Enhance LinkedIn")
|
| 648 |
linkedin_output = gr.Markdown("")
|
| 649 |
status_text = gr.Markdown(" ")
|
|
@@ -653,11 +652,11 @@ textarea[aria-label*="Resume Strength"], textarea[aria-label*="Predicted Job Rol
|
|
| 653 |
shared_resume_file = gr.File(label="π Upload Resume Again", file_types=[".pdf"])
|
| 654 |
|
| 655 |
with gr.Column(elem_classes="card"):
|
| 656 |
-
jd_text_input = gr.Textbox(label="π Paste
|
| 657 |
with gr.Row():
|
| 658 |
-
jd_match_btn = gr.Button("π Match with JD")
|
| 659 |
jd_clear_btn = gr.Button("π§Ή Clear", variant="secondary")
|
| 660 |
-
download_jd_btn = gr.Button("π₯
|
| 661 |
jd_status = gr.Markdown(" ")
|
| 662 |
jd_output = gr.Markdown("")
|
| 663 |
|
|
@@ -666,6 +665,8 @@ textarea[aria-label*="Resume Strength"], textarea[aria-label*="Predicted Job Rol
|
|
| 666 |
|
| 667 |
with gr.Column(elem_classes="card"):
|
| 668 |
explore_btn = gr.Button("π Suggest Jobs")
|
|
|
|
|
|
|
| 669 |
explore_status = gr.Markdown(" ")
|
| 670 |
explore_output = gr.Markdown("")
|
| 671 |
|
|
@@ -755,11 +756,25 @@ textarea[aria-label*="Resume Strength"], textarea[aria-label*="Predicted Job Rol
|
|
| 755 |
inputs=[],
|
| 756 |
outputs=[jd_status] # Update JD status
|
| 757 |
)
|
|
|
|
|
|
|
| 758 |
jd_clear_btn.click(
|
| 759 |
fn=clear_jd_fields,
|
| 760 |
inputs=[],
|
| 761 |
outputs=[shared_resume_file, jd_text_input, jd_output, jd_status, jd_pdf_file]
|
| 762 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 763 |
|
| 764 |
|
| 765 |
|
|
@@ -778,15 +793,20 @@ textarea[aria-label*="Resume Strength"], textarea[aria-label*="Predicted Job Rol
|
|
| 778 |
outputs=[explore_status]
|
| 779 |
)
|
| 780 |
# Added clear_explore_btn click event
|
| 781 |
-
|
| 782 |
-
|
| 783 |
-
|
| 784 |
-
|
| 785 |
-
|
| 786 |
def rewrite_jd_flow(resume_file, jd_text_input):
|
| 787 |
-
|
| 788 |
-
|
| 789 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 790 |
|
| 791 |
download_jd_btn.click(
|
| 792 |
fn=lambda: "β³ Preparing tailored resume for JD... please wait.",
|
|
@@ -821,9 +841,8 @@ textarea[aria-label*="Resume Strength"], textarea[aria-label*="Predicted Job Rol
|
|
| 821 |
|
| 822 |
|
| 823 |
gr.Markdown(
|
| 824 |
-
"<p style='text-align:center; font-size: 14px;'>β¨ Built with π» ML + GPT | Made for the AI Challenge
|
| 825 |
|
| 826 |
demo.launch()
|
| 827 |
-
|
| 828 |
if __name__ == "__main__":
|
| 829 |
demo.launch()
|
|
|
|
| 69 |
return sum(weight for kw, weight in weighted_keywords.items() if kw in text)
|
| 70 |
|
| 71 |
|
|
|
|
| 72 |
# GPT Job Role Prediction
|
| 73 |
roles = ["AI Engineer", "Data Scientist", "Project Manager", "Sales Executive", "Teacher", "HR Specialist", "Security Officer"]
|
| 74 |
|
|
|
|
| 642 |
tips_output = gr.Markdown("")
|
| 643 |
|
| 644 |
with gr.Column(elem_classes="card"):
|
| 645 |
+
about_input = gr.Textbox(label="LinkedIn About(Can PAste Your About me or it will generate from the resume) (Optional)", lines=3)
|
| 646 |
linkedin_btn = gr.Button("β¨ Enhance LinkedIn")
|
| 647 |
linkedin_output = gr.Markdown("")
|
| 648 |
status_text = gr.Markdown(" ")
|
|
|
|
| 652 |
shared_resume_file = gr.File(label="π Upload Resume Again", file_types=[".pdf"])
|
| 653 |
|
| 654 |
with gr.Column(elem_classes="card"):
|
| 655 |
+
jd_text_input = gr.Textbox(label="π Paste Job Description")
|
| 656 |
with gr.Row():
|
| 657 |
+
jd_match_btn = gr.Button("π Match with JD",visible=False,interactive=False)
|
| 658 |
jd_clear_btn = gr.Button("π§Ή Clear", variant="secondary")
|
| 659 |
+
download_jd_btn = gr.Button("π₯ Enhanced Resume ",visible=False,interactive=False)
|
| 660 |
jd_status = gr.Markdown(" ")
|
| 661 |
jd_output = gr.Markdown("")
|
| 662 |
|
|
|
|
| 665 |
|
| 666 |
with gr.Column(elem_classes="card"):
|
| 667 |
explore_btn = gr.Button("π Suggest Jobs")
|
| 668 |
+
clear_explore_btn = gr.Button("π§Ή Clear Explorer", variant="secondary")
|
| 669 |
+
|
| 670 |
explore_status = gr.Markdown(" ")
|
| 671 |
explore_output = gr.Markdown("")
|
| 672 |
|
|
|
|
| 756 |
inputs=[],
|
| 757 |
outputs=[jd_status] # Update JD status
|
| 758 |
)
|
| 759 |
+
|
| 760 |
+
|
| 761 |
jd_clear_btn.click(
|
| 762 |
fn=clear_jd_fields,
|
| 763 |
inputs=[],
|
| 764 |
outputs=[shared_resume_file, jd_text_input, jd_output, jd_status, jd_pdf_file]
|
| 765 |
)
|
| 766 |
+
jd_text_input.change(
|
| 767 |
+
lambda jd: gr.update(visible=bool(jd.strip()), interactive=bool(jd.strip())),
|
| 768 |
+
inputs=[jd_text_input],
|
| 769 |
+
outputs=[jd_match_btn]
|
| 770 |
+
)
|
| 771 |
+
jd_match_btn.click(
|
| 772 |
+
fn=lambda: gr.update(visible=True, interactive=True),
|
| 773 |
+
inputs=[],
|
| 774 |
+
outputs=[download_jd_btn]
|
| 775 |
+
)
|
| 776 |
+
|
| 777 |
+
|
| 778 |
|
| 779 |
|
| 780 |
|
|
|
|
| 793 |
outputs=[explore_status]
|
| 794 |
)
|
| 795 |
# Added clear_explore_btn click event
|
| 796 |
+
clear_explore_btn.click(
|
| 797 |
+
fn=clear_explore_fields,
|
| 798 |
+
inputs=[],
|
| 799 |
+
outputs=[shared_resume_file, explore_output, explore_status]
|
| 800 |
+
)
|
| 801 |
def rewrite_jd_flow(resume_file, jd_text_input):
|
| 802 |
+
path, msg = rewrite_resume_for_jd(resume_file, jd_text_input)
|
| 803 |
+
print("β
JD PDF Path:", path)
|
| 804 |
+
if path:
|
| 805 |
+
return gr.update(value=path, visible=True, interactive=True), msg
|
| 806 |
+
else:
|
| 807 |
+
return gr.update(visible=False), "β Failed to generate resume."
|
| 808 |
+
|
| 809 |
+
|
| 810 |
|
| 811 |
download_jd_btn.click(
|
| 812 |
fn=lambda: "β³ Preparing tailored resume for JD... please wait.",
|
|
|
|
| 841 |
|
| 842 |
|
| 843 |
gr.Markdown(
|
| 844 |
+
"<p style='text-align:center; font-size: 14px;'>β¨ Built with π» ML + GPT | Made for the AI Challenge by Kiruthika Ramalingam</p>")
|
| 845 |
|
| 846 |
demo.launch()
|
|
|
|
| 847 |
if __name__ == "__main__":
|
| 848 |
demo.launch()
|