Spaces:
Sleeping
Sleeping
Download resume.py from flexingdatai/Resume_ATS_Checker: direct link, hf CLI and curl.
- Browser
- Download file 1.7 kB
-
https://huggingface.co/spaces/flexingdatai/Resume_ATS_Checker/resolve/main/resume.py
- Command line
-
hf download hf://spaces/flexingdatai/Resume_ATS_Checker/resume.py
-
curl -L -o resume.py https://huggingface.co/spaces/flexingdatai/Resume_ATS_Checker/resolve/main/resume.py
1.7 kB
| 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) |