Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from langchain_community.document_loaders.pdf import PyPDFLoader
|
| 3 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
|
@@ -107,6 +108,7 @@ def process_skill_gap(resume_pdf, jd_pdfs, jd_link_url):
|
|
| 107 |
return "", "", "", "", "", None, "", "", "", ""
|
| 108 |
|
| 109 |
scraped_skills_text = ""
|
|
|
|
| 110 |
if jd_link_url:
|
| 111 |
scraped_skills = scrape_skills_from_jd_link(jd_link_url)
|
| 112 |
scraped_skills_text = ", ".join(scraped_skills)
|
|
@@ -132,6 +134,17 @@ def process_skill_gap(resume_pdf, jd_pdfs, jd_link_url):
|
|
| 132 |
ai_report = generate_skill_gap_report(user_skills, job_skills, missing_skills, match_percent)
|
| 133 |
full_report += f"\nJD {idx}:\nSkill Match: {match_percent}%\nMissing Skills: {', '.join(missing_skills) if missing_skills else 'None'}\nSimilarity Score: {similarity_percent}%\nAI Report:\n{ai_report}\n-------------------------\n"
|
| 134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
resources = generate_learning_resources(list(set(all_missing_skills)))
|
| 136 |
certifications = suggest_certifications(all_missing_skills)
|
| 137 |
|
|
@@ -152,14 +165,9 @@ def process_skill_gap(resume_pdf, jd_pdfs, jd_link_url):
|
|
| 152 |
return progress_display, "β
Analysis done across all JDs", ", ".join(set(all_missing_skills)), "Multi-JD Comparison Completed", full_report, pdf_path, top_missing_skills_text, resources, certifications, scraped_skills_text
|
| 153 |
|
| 154 |
with gr.Blocks() as demo:
|
| 155 |
-
gr.HTML("""<style>body{background: linear-gradient(135deg, #0d1b2a, #1b263b, #415a77);background-size: 300% 300%;animation: gradientShift 15s ease infinite;overflow-x: hidden;position: relative}@keyframes gradientShift{0%{background-position:0% 50%}50%{background-position:100% 50%}100%{background-position:0% 50%}.floating-circle{position:fixed;border-radius:50%;background:rgba(0,255,255,0.08);box-shadow:0 0 20px rgba(0,255,255,0.2);animation:floatUp linear infinite;z-index:-1;filter:blur(2px)}@keyframes floatUp{0%{transform:translateY(100vh);opacity:0}10%{opacity:.2}90%{opacity:.2}100%{transform:translateY(-200px);opacity:0}}.floating-circle:nth-child(1){width:80px;height:80px;left:20%;animation-duration:25s}.floating-circle:nth-child(2){width:100px;height:100px;left:50%;animation-duration:30s;animation-delay:5s}.floating-circle:nth-child(3){width:60px;height:60px;left:70%;animation-duration:20s;animation-delay:10s}.floating-circle:nth-child(4){width:90px;height:90px;left:35%;animation-duration:35s;animation-delay:15s}.floating-circle:nth-child(5){width:120px;height:120px;left:80%;animation-duration:40s;animation-delay:20s}h1,h2,h3,p,label{color:#00f7ff!important;text-shadow:0 0 8px rgba(0,255,255,0.3)}</style><div class='floating-circle'></div><div class='floating-circle'></div><div class='floating-circle'></div><div class='floating-circle'></div><div class='floating-circle'></div>""")
|
| 156 |
-
|
| 157 |
-
gr.Markdown("# π§ TALENTPATCH with Multi-JD Comparison and AI Skill Gap Analysis")
|
| 158 |
-
|
| 159 |
resume_file = gr.File(label="π Upload Resume (PDF)", type="binary")
|
| 160 |
jd_files = gr.File(label="π Upload Multiple Job Descriptions (PDFs)", type="binary", file_types=[".pdf"], file_count="multiple")
|
| 161 |
jd_link_input = gr.Textbox(label="π Optional: Paste JD URL for Real-Time Skill Extraction")
|
| 162 |
-
|
| 163 |
match_progress = gr.HTML(label="Skill Match Progress")
|
| 164 |
skill_match_text = gr.Textbox(label="Status", interactive=False)
|
| 165 |
missing_skills_text = gr.Textbox(label="All Missing Skills", interactive=False)
|
|
@@ -170,9 +178,7 @@ with gr.Blocks() as demo:
|
|
| 170 |
learning_resources = gr.Markdown(label="π AI Learning Resource Recommendations")
|
| 171 |
certification_output = gr.Textbox(label="π Recommended Certifications", interactive=False)
|
| 172 |
scraped_skills_output = gr.Textbox(label="π Skills Extracted from JD Link", interactive=False)
|
| 173 |
-
|
| 174 |
submit_btn = gr.Button("π Analyze Skill Gap")
|
| 175 |
-
|
| 176 |
submit_btn.click(
|
| 177 |
fn=process_skill_gap,
|
| 178 |
inputs=[resume_file, jd_files, jd_link_input],
|
|
@@ -189,5 +195,4 @@ with gr.Blocks() as demo:
|
|
| 189 |
scraped_skills_output
|
| 190 |
]
|
| 191 |
)
|
| 192 |
-
|
| 193 |
demo.launch()
|
|
|
|
| 1 |
+
|
| 2 |
import gradio as gr
|
| 3 |
from langchain_community.document_loaders.pdf import PyPDFLoader
|
| 4 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
|
|
|
| 108 |
return "", "", "", "", "", None, "", "", "", ""
|
| 109 |
|
| 110 |
scraped_skills_text = ""
|
| 111 |
+
scraped_skills = []
|
| 112 |
if jd_link_url:
|
| 113 |
scraped_skills = scrape_skills_from_jd_link(jd_link_url)
|
| 114 |
scraped_skills_text = ", ".join(scraped_skills)
|
|
|
|
| 134 |
ai_report = generate_skill_gap_report(user_skills, job_skills, missing_skills, match_percent)
|
| 135 |
full_report += f"\nJD {idx}:\nSkill Match: {match_percent}%\nMissing Skills: {', '.join(missing_skills) if missing_skills else 'None'}\nSimilarity Score: {similarity_percent}%\nAI Report:\n{ai_report}\n-------------------------\n"
|
| 136 |
|
| 137 |
+
# Include scraped JD link in the analysis
|
| 138 |
+
if scraped_skills_text and scraped_skills and scraped_skills != ["No skills detected."]:
|
| 139 |
+
job_skills = scraped_skills
|
| 140 |
+
common = set(user_skills) & set(job_skills)
|
| 141 |
+
match_percent = (len(common) / len(job_skills)) * 100 if job_skills else 0
|
| 142 |
+
missing_skills = list(set(job_skills) - set(user_skills))
|
| 143 |
+
all_missing_skills.extend(missing_skills)
|
| 144 |
+
|
| 145 |
+
ai_report = generate_skill_gap_report(user_skills, job_skills, missing_skills, match_percent)
|
| 146 |
+
full_report += f"\nReal-Time JD Link:\nSkill Match: {match_percent}%\nMissing Skills: {', '.join(missing_skills) if missing_skills else 'None'}\nAI Report:\n{ai_report}\n-------------------------\n"
|
| 147 |
+
|
| 148 |
resources = generate_learning_resources(list(set(all_missing_skills)))
|
| 149 |
certifications = suggest_certifications(all_missing_skills)
|
| 150 |
|
|
|
|
| 165 |
return progress_display, "β
Analysis done across all JDs", ", ".join(set(all_missing_skills)), "Multi-JD Comparison Completed", full_report, pdf_path, top_missing_skills_text, resources, certifications, scraped_skills_text
|
| 166 |
|
| 167 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
resume_file = gr.File(label="π Upload Resume (PDF)", type="binary")
|
| 169 |
jd_files = gr.File(label="π Upload Multiple Job Descriptions (PDFs)", type="binary", file_types=[".pdf"], file_count="multiple")
|
| 170 |
jd_link_input = gr.Textbox(label="π Optional: Paste JD URL for Real-Time Skill Extraction")
|
|
|
|
| 171 |
match_progress = gr.HTML(label="Skill Match Progress")
|
| 172 |
skill_match_text = gr.Textbox(label="Status", interactive=False)
|
| 173 |
missing_skills_text = gr.Textbox(label="All Missing Skills", interactive=False)
|
|
|
|
| 178 |
learning_resources = gr.Markdown(label="π AI Learning Resource Recommendations")
|
| 179 |
certification_output = gr.Textbox(label="π Recommended Certifications", interactive=False)
|
| 180 |
scraped_skills_output = gr.Textbox(label="π Skills Extracted from JD Link", interactive=False)
|
|
|
|
| 181 |
submit_btn = gr.Button("π Analyze Skill Gap")
|
|
|
|
| 182 |
submit_btn.click(
|
| 183 |
fn=process_skill_gap,
|
| 184 |
inputs=[resume_file, jd_files, jd_link_input],
|
|
|
|
| 195 |
scraped_skills_output
|
| 196 |
]
|
| 197 |
)
|
|
|
|
| 198 |
demo.launch()
|