Ram-1103's picture
Create app.py
fba3f15 verified
Raw
History Blame Contribute Delete
4.69 kB
import gradio as gr
from huggingface_hub import InferenceClient
client = InferenceClient("Qwen/Qwen2.5-3B-Instruct")
SYSTEM_PROMPT = """You are a brutally honest but helpful senior hiring manager with 15 years of experience.
Your job is to tell candidates EXACTLY why they will be rejected β€” not a vague match score, but a specific, actionable rejection explanation.
You must output your response in this exact structure:
## ❌ Why You Will Likely Be Rejected
[2-3 specific, direct sentences about the core mismatch]
## πŸ” Top 3 Skill Gaps
1. [Gap 1 β€” specific technology or skill missing]
2. [Gap 2]
3. [Gap 3]
## πŸ“‚ Missing Projects/Experience
- [What kind of project would fill this gap]
- [Another project]
- [Another project]
## πŸ”‘ Missing Keywords (for ATS systems)
[comma-separated list of keywords from the job description not present in the resume]
## πŸ“… 30-Day Improvement Plan
**Week 1:** [Specific action]
**Week 2:** [Specific action]
**Week 3:** [Specific action]
**Week 4:** [Specific action β€” ideally a project to show]
## πŸ’‘ One Honest Verdict
[One sentence: should they apply now, in 3 months, or pivot entirely?]
Be specific. Name actual technologies. Do not be vague. Do not be encouraging unless there is a real reason to be."""
def analyze(resume_text, job_description):
if not resume_text.strip() or not job_description.strip():
return "⚠️ Please paste both your resume and the job description."
user_message = f"""Here is the candidate's resume:
---
{resume_text}
---
Here is the job description they want to apply to:
---
{job_description}
---
Tell them exactly why they will be rejected and what to do about it."""
response = client.chat_completion(
messages=[
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": user_message}
],
max_tokens=1024,
temperature=0.7,
)
return response.choices[0].message.content
EXAMPLE_RESUME = """Name: Priya Sharma
Education: M.S. Computer Science, 2024
Skills: Python, PyTorch, NLP, Transformers, BERT fine-tuning, HuggingFace, scikit-learn, pandas, numpy
Projects:
- Sentiment analysis model on Twitter data using BERT
- Named Entity Recognition system for biomedical text
- Research paper: "Improving low-resource NER with cross-lingual transfer"
Experience:
- ML Research Intern, university NLP lab (6 months)
- TA for Introduction to Machine Learning course"""
EXAMPLE_JD = """Senior ML Engineer β€” Infrastructure
Company: CloudScale Inc.
Requirements:
- 3+ years deploying ML models at scale in production
- Strong knowledge of Kubernetes, Docker, MLflow
- Experience with distributed training (Horovod, DeepSpeed)
- Familiarity with AWS SageMaker or GCP Vertex AI
- Python, Go, or Rust for systems-level work
- Experience with data pipelines: Spark, Kafka, Airflow
- Nice to have: ONNX optimization, TensorRT, model quantization"""
with gr.Blocks(
theme=gr.themes.Soft(),
title="Rejected Before Applying",
css="""
.header { text-align: center; margin-bottom: 20px; }
.warning-box { background: #fff3cd; border-left: 4px solid #ff6b35; padding: 12px; border-radius: 6px; }
"""
) as demo:
gr.HTML("""
<div class='header'>
<h1>πŸ’” Rejected Before Applying</h1>
<p style='font-size:1.1em; color:#666;'>
Find out <b>exactly why</b> your resume won't make it β€” before you waste the application.
</p>
<p style='color:#888; font-size:0.9em;'>Powered by Qwen2.5-3B β€’ No data stored β€’ Brutal honesty guaranteed</p>
</div>
""")
with gr.Row():
with gr.Column():
resume_input = gr.Textbox(
label="πŸ“„ Your Resume (paste as plain text)",
placeholder="Paste your resume here β€” skills, experience, education, projects...",
lines=15,
value=EXAMPLE_RESUME
)
with gr.Column():
jd_input = gr.Textbox(
label="πŸ’Ό Job Description (paste the full JD)",
placeholder="Paste the job description here...",
lines=15,
value=EXAMPLE_JD
)
analyze_btn = gr.Button("πŸ” Analyse My Rejection", variant="primary", size="lg")
output = gr.Markdown(label="Your Rejection Report")
analyze_btn.click(
fn=analyze,
inputs=[resume_input, jd_input],
outputs=output
)
gr.HTML("""
<div style='text-align:center; margin-top:20px; color:#aaa; font-size:0.85em;'>
Built for the πŸ€— Build Small Hackathon β€’ Small model, real talk
</div>
""")
demo.launch()