Update app.py
Browse files
app.py
CHANGED
|
@@ -281,64 +281,4 @@ def analyze_cv_match(cv_file_obj, cv_text_input, jd_text_input):
|
|
| 281 |
<h4>Skills Analysis</h4>
|
| 282 |
<p><strong>β
Matched Skills:</strong> {', '.join(analysis_results['matched_skills']) if analysis_results['matched_skills'] else 'None found matching job description.'}</p>
|
| 283 |
<p><strong>β Missing Skills (from Job Description):</strong> {', '.join(analysis_results['missing_skills']) if analysis_results['missing_skills'] else 'π₯³ None! Your CV has all specified skills.'}</p>
|
| 284 |
-
<p><strong>π‘ Extra Skills in CV (not in Job Description):</strong> {', '.join(
|
| 285 |
-
<h4>Keyword Relevance (Top TF-IDF Terms)</h4>
|
| 286 |
-
<p><strong>π€ Top Common Keywords:</strong> {', '.join(analysis_results['common_keywords']) if analysis_results['common_keywords'] else 'No significant common keywords beyond skills.'}</p>
|
| 287 |
-
<p><strong>π Top Keywords in Your CV:**</strong> {', '.join(analysis_results['top_cv_keywords']) if analysis_results['top_cv_keywords'] else 'N/A'}</p>
|
| 288 |
-
<p><strong>π― Top Keywords in Job Description:</strong> {', '.join(analysis_results['top_jd_keywords']) if analysis_results['top_jd_keywords'] else 'N/A'}</p>
|
| 289 |
-
<h4>Experience & Education Comparison</h4>
|
| 290 |
-
<p><strong>π€ Your CV's Experience:</strong> <code>{analysis_results['cv_years_experience']}</code> years</p>
|
| 291 |
-
<p><strong>πΌ Job's Required Experience:</strong> <code>{analysis_results['jd_years_experience']}</code> years</p>
|
| 292 |
-
<p style='color:green;'><strong>Status:</strong> {analysis_results['experience_match_status']}</p>
|
| 293 |
-
<p><strong>π Your CV's Education:</strong> <code>{analysis_results['cv_education_level']}</code></p>
|
| 294 |
-
<p><strong>π Job's Required Education:</strong> <code>{analysis_results['jd_education_level']}</code></p>
|
| 295 |
-
<p style='color:green;'><strong>Status:</strong> {analysis_results['education_match_status']}</p>
|
| 296 |
-
"""
|
| 297 |
-
overall_plot = create_overall_match_plot(analysis_results['overall_match_score'])
|
| 298 |
-
skill_plot = create_skill_match_plot(analysis_results['matched_skills'], analysis_results['missing_skills'])
|
| 299 |
-
keywords_plot = create_top_keywords_plot(analysis_results['top_cv_keywords'], analysis_results['top_jd_keywords'])
|
| 300 |
-
return html_output, overall_plot, skill_plot, keywords_plot, "Analysis Complete!"
|
| 301 |
-
except Exception as e:
|
| 302 |
-
import traceback
|
| 303 |
-
error_traceback = traceback.format_exc()
|
| 304 |
-
return (f"<h4><p style='color:red;'>An unexpected error occurred during analysis: {e}</p></h4>"
|
| 305 |
-
f"<details><summary>Click for details</summary><pre>{error_traceback}</pre></details>",
|
| 306 |
-
None, None, None, "Analysis Failed")
|
| 307 |
-
|
| 308 |
-
# --- Gradio Interface Definition ---
|
| 309 |
-
with gr.Blocks(theme=gr.themes.Soft(), title="CV-Job Match Analyzer") as demo:
|
| 310 |
-
|
| 311 |
-
# THIS IS THE NEW LINE TO ADD EMPTY SPACE AT THE TOP
|
| 312 |
-
gr.Markdown("<br>" * 5)
|
| 313 |
-
|
| 314 |
-
gr.Markdown(
|
| 315 |
-
"""
|
| 316 |
-
# π¨βπΌ CV-Job Match Analyzer π
|
| 317 |
-
Welcome! This tool helps you understand how well a CV matches a job description.
|
| 318 |
-
Upload a CV (PDF, DOCX, TXT) and paste the job description text to get an instant analysis.
|
| 319 |
-
"""
|
| 320 |
-
)
|
| 321 |
-
with gr.Row():
|
| 322 |
-
with gr.Column(scale=1, min_width=400):
|
| 323 |
-
gr.Markdown("## **1. Your CV**")
|
| 324 |
-
cv_file_obj = gr.File(label="Upload CV (PDF, DOCX, TXT)", file_types=[".pdf", ".docx", ".txt"])
|
| 325 |
-
cv_text_input = gr.Textbox(label="Or paste CV text here (overrides file upload)", lines=10, placeholder="Paste your CV content here...")
|
| 326 |
-
gr.Markdown("## **2. Job Description**")
|
| 327 |
-
jd_text_input = gr.Textbox(label="Paste the Job Description text here", lines=10, placeholder="Paste the job description content here...")
|
| 328 |
-
with gr.Row():
|
| 329 |
-
analyze_button = gr.Button("β¨ Analyze CV Match β¨", variant="primary", scale=1)
|
| 330 |
-
clear_button = gr.ClearButton([cv_file_obj, cv_text_input, jd_text_input], scale=1)
|
| 331 |
-
with gr.Column(scale=2, min_width=600):
|
| 332 |
-
output_html = gr.HTML(label="Analysis Report")
|
| 333 |
-
gr.Markdown("## **π Visual Insights**")
|
| 334 |
-
output_overall_plot = gr.Plot(label="Overall Match Score")
|
| 335 |
-
output_skill_plot = gr.Plot(label="Skill Match Breakdown")
|
| 336 |
-
output_keywords_plot = gr.Plot(label="Top Keywords")
|
| 337 |
-
|
| 338 |
-
analyze_button.click(
|
| 339 |
-
fn=analyze_cv_match,
|
| 340 |
-
inputs=[cv_file_obj, cv_text_input, jd_text_input],
|
| 341 |
-
outputs=[output_html, output_overall_plot, output_skill_plot, output_keywords_plot, gr.State(value="")],
|
| 342 |
-
)
|
| 343 |
-
|
| 344 |
-
demo.launch()
|
|
|
|
| 281 |
<h4>Skills Analysis</h4>
|
| 282 |
<p><strong>β
Matched Skills:</strong> {', '.join(analysis_results['matched_skills']) if analysis_results['matched_skills'] else 'None found matching job description.'}</p>
|
| 283 |
<p><strong>β Missing Skills (from Job Description):</strong> {', '.join(analysis_results['missing_skills']) if analysis_results['missing_skills'] else 'π₯³ None! Your CV has all specified skills.'}</p>
|
| 284 |
+
<p><strong>π‘ Extra Skills in CV (not in Job Description):</strong> {', '.join(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|