Spaces:
Sleeping
Sleeping
File size: 1,698 Bytes
01219c4 be85368 52b692d be85368 01219c4 be85368 01219c4 be85368 01219c4 be85368 01219c4 be85368 618b112 | 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | import streamlit as st
from PyPDF2 import PdfReader
import google.generativeai as genai
# PDF text extractor
def pdf_to_text(pdf):
reader = PdfReader(pdf)
text = "".join(page.extract_text() or "" for page in reader.pages)
return text
# Gemini AI resume analysis
def analyze(api_key, job_desc, resume):
genai.configure(api_key=api_key)
model = genai.GenerativeModel('gemini-2.5-pro')
prompt = f"""Analyze the resume for this role:
Job Description: {job_desc}
Resume: {resume}
Provide:
- Match Score (0-100)%
- 3 Matching Keywords
- 3 Missing Keywords
- 2 Strengths
- 2 Gaps
- 2 Improvement suggestions
- Verdict: Strong, Average, or Needs Work."""
return model.generate_content(prompt).text
# Streamlit UI
st.title("📝 Resume Checker")
st.write("Check your resume against a job description using AI.")
api_key = st.text_input("Gemini API Key", type="password")
job_desc = st.text_area("Job Description")
pdf = st.file_uploader("Upload Resume (PDF)", type="pdf")
if st.button("Analyze"):
if api_key and job_desc and pdf:
resume_text = pdf_to_text(pdf)
if resume_text:
with st.spinner("Analyzing..."):
result = analyze(api_key, job_desc, resume_text)
st.write(result)
else:
st.error("Can't extract text from PDF. Use a text-based PDF.")
else:
st.warning("Please provide API key, job description, and resume.")
st.markdown("""
---
Made with ❤️ by [Shashank Kashyap](https://flexingdata.com) |
[LinkedIn](https://www.linkedin.com/in/imshashankashyap/) 🌐 [Flexing Data](https://flexingdata.com)
""", unsafe_allow_html=True) |