Kiruthikaramalingam commited on
Commit
dea8a35
Β·
verified Β·
1 Parent(s): 1c0a993

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -15
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 JD")
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("πŸ“₯ JD Resume")
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
- #clear_explore_btn.click(
782
- # fn=clear_explore_fields,
783
- # inputs=[],
784
- # outputs=[shared_resume_file, explore_output, explore_status]
785
- #)
786
  def rewrite_jd_flow(resume_file, jd_text_input):
787
- path, msg = rewrite_resume_for_jd(resume_file, jd_text_input)
788
- print("βœ… JD PDF Path:", path)
789
- return gr.update(value=path, visible=True, interactive=True), msg
 
 
 
 
 
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 By Kiruthika Ramalingam</p>")
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()