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qwen2.5-3B-Instruct",
|
| 6 |
+
token=None # Uses the Space's built-in HF token automatically
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
SYSTEM_PROMPT = """You are a brutally honest but helpful senior hiring manager with 15 years of experience.
|
| 10 |
+
Your job is to tell candidates EXACTLY why they will be rejected β not a vague match score, but a specific, actionable rejection explanation.
|
| 11 |
+
|
| 12 |
+
You must output your response in this exact structure:
|
| 13 |
+
|
| 14 |
+
## β Why You Will Likely Be Rejected
|
| 15 |
+
[2-3 specific, direct sentences about the core mismatch]
|
| 16 |
+
|
| 17 |
+
## π Top 3 Skill Gaps
|
| 18 |
+
1. [Gap 1 β specific technology or skill missing]
|
| 19 |
+
2. [Gap 2]
|
| 20 |
+
3. [Gap 3]
|
| 21 |
+
|
| 22 |
+
## π Missing Projects/Experience
|
| 23 |
+
- [What kind of project would fill this gap]
|
| 24 |
+
- [Another project]
|
| 25 |
+
- [Another project]
|
| 26 |
+
|
| 27 |
+
## π Missing Keywords (for ATS systems)
|
| 28 |
+
[comma-separated list of keywords from the job description not present in the resume]
|
| 29 |
+
|
| 30 |
+
## π
30-Day Improvement Plan
|
| 31 |
+
**Week 1:** [Specific action]
|
| 32 |
+
**Week 2:** [Specific action]
|
| 33 |
+
**Week 3:** [Specific action]
|
| 34 |
+
**Week 4:** [Specific action β ideally a project to show]
|
| 35 |
+
|
| 36 |
+
## π‘ One Honest Verdict
|
| 37 |
+
[One sentence: should they apply now, in 3 months, or pivot entirely?]
|
| 38 |
+
|
| 39 |
+
Be specific. Name actual technologies. Do not be vague. Do not be encouraging unless there is a real reason to be."""
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def analyze(resume_text, job_description):
|
| 43 |
+
if not resume_text.strip() or not job_description.strip():
|
| 44 |
+
return "β οΈ Please paste both your resume and the job description."
|
| 45 |
+
|
| 46 |
+
user_message = f"""Here is the candidate's resume:
|
| 47 |
+
---
|
| 48 |
+
{resume_text}
|
| 49 |
+
---
|
| 50 |
+
|
| 51 |
+
Here is the job description they want to apply to:
|
| 52 |
+
---
|
| 53 |
+
{job_description}
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
Tell them exactly why they will be rejected and what to do about it."""
|
| 57 |
+
|
| 58 |
+
try:
|
| 59 |
+
response = client.chat_completion(
|
| 60 |
+
messages=[
|
| 61 |
+
{"role": "system", "content": SYSTEM_PROMPT},
|
| 62 |
+
{"role": "user", "content": user_message}
|
| 63 |
+
],
|
| 64 |
+
max_tokens=1024,
|
| 65 |
+
temperature=0.7,
|
| 66 |
+
)
|
| 67 |
+
return response.choices[0].message.content
|
| 68 |
+
except Exception as e:
|
| 69 |
+
return f"β Error: {str(e)}\n\nTry refreshing the page and clicking the button again."
|
| 70 |
+
|
| 71 |
+
EXAMPLE_RESUME = """Name: Priya Sharma
|
| 72 |
+
Education: M.S. Computer Science, 2024
|
| 73 |
+
|
| 74 |
+
Skills: Python, PyTorch, NLP, Transformers, BERT fine-tuning, HuggingFace, scikit-learn, pandas, numpy
|
| 75 |
+
|
| 76 |
+
Projects:
|
| 77 |
+
- Sentiment analysis model on Twitter data using BERT
|
| 78 |
+
- Named Entity Recognition system for biomedical text
|
| 79 |
+
- Research paper: "Improving low-resource NER with cross-lingual transfer"
|
| 80 |
+
|
| 81 |
+
Experience:
|
| 82 |
+
- ML Research Intern, university NLP lab (6 months)
|
| 83 |
+
- TA for Introduction to Machine Learning course"""
|
| 84 |
+
|
| 85 |
+
EXAMPLE_JD = """Senior ML Engineer β Infrastructure
|
| 86 |
+
Company: CloudScale Inc.
|
| 87 |
+
|
| 88 |
+
Requirements:
|
| 89 |
+
- 3+ years deploying ML models at scale in production
|
| 90 |
+
- Strong knowledge of Kubernetes, Docker, MLflow
|
| 91 |
+
- Experience with distributed training (Horovod, DeepSpeed)
|
| 92 |
+
- Familiarity with AWS SageMaker or GCP Vertex AI
|
| 93 |
+
- Python, Go, or Rust for systems-level work
|
| 94 |
+
- Experience with data pipelines: Spark, Kafka, Airflow
|
| 95 |
+
- Nice to have: ONNX optimization, TensorRT, model quantization"""
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
with gr.Blocks(
|
| 99 |
+
theme=gr.themes.Soft(),
|
| 100 |
+
title="Rejected Before Applying",
|
| 101 |
+
css="""
|
| 102 |
+
.header { text-align: center; margin-bottom: 20px; }
|
| 103 |
+
.warning-box { background: #fff3cd; border-left: 4px solid #ff6b35; padding: 12px; border-radius: 6px; }
|
| 104 |
+
"""
|
| 105 |
+
) as demo:
|
| 106 |
+
gr.HTML("""
|
| 107 |
+
<div class='header'>
|
| 108 |
+
<h1>π Rejected Before Applying</h1>
|
| 109 |
+
<p style='font-size:1.1em; color:#666;'>
|
| 110 |
+
Find out <b>exactly why</b> your resume won't make it β before you waste the application.
|
| 111 |
+
</p>
|
| 112 |
+
<p style='color:#888; font-size:0.9em;'>Powered by Qwen2.5-3B β’ No data stored β’ Brutal honesty guaranteed</p>
|
| 113 |
+
</div>
|
| 114 |
+
""")
|
| 115 |
+
|
| 116 |
+
with gr.Row():
|
| 117 |
+
with gr.Column():
|
| 118 |
+
resume_input = gr.Textbox(
|
| 119 |
+
label="π Your Resume (paste as plain text)",
|
| 120 |
+
placeholder="Paste your resume here β skills, experience, education, projects...",
|
| 121 |
+
lines=15,
|
| 122 |
+
value=EXAMPLE_RESUME
|
| 123 |
+
)
|
| 124 |
+
with gr.Column():
|
| 125 |
+
jd_input = gr.Textbox(
|
| 126 |
+
label="πΌ Job Description (paste the full JD)",
|
| 127 |
+
placeholder="Paste the job description here...",
|
| 128 |
+
lines=15,
|
| 129 |
+
value=EXAMPLE_JD
|
| 130 |
+
)
|
| 131 |
+
|
| 132 |
+
analyze_btn = gr.Button("π Analyse My Rejection", variant="primary", size="lg")
|
| 133 |
+
|
| 134 |
+
output = gr.Markdown(label="Your Rejection Report")
|
| 135 |
+
|
| 136 |
+
analyze_btn.click(
|
| 137 |
+
fn=analyze,
|
| 138 |
+
inputs=[resume_input, jd_input],
|
| 139 |
+
outputs=output
|
| 140 |
+
)
|
| 141 |
+
|
| 142 |
+
gr.HTML("""
|
| 143 |
+
<div style='text-align:center; margin-top:20px; color:#aaa; font-size:0.85em;'>
|
| 144 |
+
Built for the π€ Build Small Hackathon β’ Small model, real talk
|
| 145 |
+
</div>
|
| 146 |
+
""")
|
| 147 |
+
|
| 148 |
+
demo.launch()
|