File size: 1,425 Bytes
3c06ec2
50c02b0
 
f93c703
50c02b0
 
 
1ab7e62
50c02b0
ed9c544
50c02b0
 
3c06ec2
50c02b0
 
 
1ab7e62
ed9c544
5c93693
 
 
 
ed9c544
 
5c93693
ed9c544
5c93693
ed9c544
50c02b0
3c06ec2
1ab7e62
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import gradio as gr
from keybert import KeyBERT
from sentence_transformers import SentenceTransformer

# βœ… Load Hugging Face model (no API key needed)
model = SentenceTransformer('all-MiniLM-L6-v2')
kw_model = KeyBERT(model)

# πŸ” Keyword extraction function
def extract_keywords(job_desc, resume_text, analyze_with_jd):
    if not resume_text.strip():
        return "Please paste your resume."

    text = job_desc + "\n\n" + resume_text if analyze_with_jd and job_desc else resume_text
    keywords = kw_model.extract_keywords(text, top_n=10, stop_words='english')
    return ", ".join([kw for kw, _ in keywords]) if keywords else "No keywords found."

# πŸŽ›οΈ Gradio UI
with gr.Blocks() as demo:
    with gr.Row():
        with gr.Column():
            analyze_checkbox = gr.Checkbox(label="Analyze with Job Description", value=True)
            job_desc = gr.Textbox(label="Job Description", lines=6, placeholder="Paste job description here...")
            resume_text = gr.Textbox(label="Resume Text", lines=12, placeholder="Paste resume content here...")
        with gr.Column():
            output_keywords = gr.Textbox(label="Extracted Keywords", lines=12)

    resume_text.change(fn=extract_keywords, inputs=[job_desc, resume_text, analyze_checkbox], outputs=output_keywords)
    job_desc.change(fn=extract_keywords, inputs=[job_desc, resume_text, analyze_checkbox], outputs=output_keywords)

demo.launch()