A tool that reads a CV and a job description, then gives a match score, a list of strengths, and the gaps a candidate needs to fill.
Use PyPDF2 to pull raw text from a resume PDF.
import PyPDF2
def extract_pdf_text(path):
with open(path, "rb") as f:
reader = PyPDF2.PdfReader(f)
return "\n".join(page.extract_text() for page in reader.pages)
cv_text = extract_pdf_text("resume.pdf")
print(cv_text[:300])
Give Gemini a structured prompt so it returns a consistent analysis.
JOB_DESC = """
We are looking for a Python Developer with 2+ years of experience.
Required skills: Python, Django or Flask, PostgreSQL, REST APIs, Git.
Nice to have: Docker, AWS, React.
"""
PROMPT = f"""
You are a technical recruiter. Analyse this CV against the job description.
JOB DESCRIPTION:
{JOB_DESC}
CANDIDATE CV:
{cv_text}
Return a JSON object with:
- score: integer 0-100
- strengths: list of 3 bullet points
- gaps: list of 3 bullet points
- verdict: one sentence summary
"""
Call the API and display the structured output.
import google.generativeai as genai, json, re
genai.configure(api_key="YOUR_GEMINI_API_KEY")
model = genai.GenerativeModel("gemini-1.5-flash")
response = model.generate_content(PROMPT)
raw = response.text
# Extract JSON from the response
json_str = re.search(r'\{.*\}', raw, re.DOTALL).group()
result = json.loads(json_str)
print(f"Match Score: {result['score']}/100")
print(f"Verdict: {result['verdict']}")
print("\nStrengths:")
for s in result['strengths']: print(f" ✓ {s}")
print("\nGaps:")
for g in result['gaps']: print(f" ✗ {g}")
Match Score: 72/100 Verdict: Strong Python background but lacks Docker and AWS experience required for this role. Strengths: ✓ 3 years of Python experience with Flask REST APIs ✓ Solid PostgreSQL database skills demonstrated in two projects ✓ Active GitHub profile with relevant open-source contributions Gaps: ✗ No Docker or containerisation experience mentioned ✗ No AWS or cloud deployment skills listed ✗ Django not mentioned despite being a core requirement
Your resume screener gives consistent, structured feedback in seconds. Build a Streamlit front-end around it for a proper HR tool.
Spotted a bug, broken code, or something that doesn't look right? Tell us what's off and we'll fix it.