Upload 3 files
Browse files
app.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from prompt import PROMPT_RESUME_ABOUT, PROMPT_ACCEPTANCE_PERCENTAGE, PROMPT_SKILL_IMPROVEMENTS
|
| 3 |
+
from utils import *
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def main():
|
| 7 |
+
st.set_page_config(
|
| 8 |
+
page_title="Resume (ATS) Review Using Gemini AI",
|
| 9 |
+
page_icon="📋",
|
| 10 |
+
layout="wide"
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
# st.write(css, unsafe_allow_html=True)
|
| 14 |
+
st.title("Resume (ATS) Review Using Gemini AI 📋")
|
| 15 |
+
|
| 16 |
+
col1, col2 = st.columns([1, 3])
|
| 17 |
+
|
| 18 |
+
with col1:
|
| 19 |
+
uploaded_file = st.file_uploader("Please Upload your Resume", type=["pdf"])
|
| 20 |
+
|
| 21 |
+
if uploaded_file is None:
|
| 22 |
+
st.warning("Please upload your image")
|
| 23 |
+
else:
|
| 24 |
+
st.success("PDF Uploaded Successfully")
|
| 25 |
+
|
| 26 |
+
submit1 = st.button("Tell Me About the Resume")
|
| 27 |
+
|
| 28 |
+
submit2 = st.button("How can I Improvise my Skills")
|
| 29 |
+
|
| 30 |
+
submit3 = st.button("Percentage match")
|
| 31 |
+
|
| 32 |
+
with col2:
|
| 33 |
+
input_text = st.text_area("Job Description:", key= "input")
|
| 34 |
+
with st.spinner('Wait for it...'):
|
| 35 |
+
if submit1:
|
| 36 |
+
if uploaded_file is not None:
|
| 37 |
+
pdf_content = input_pdf_setup(uploaded_file)
|
| 38 |
+
response = get_gemini_response(PROMPT_RESUME_ABOUT, pdf_content, input_text)
|
| 39 |
+
st.subheader("Resume Evaluation:")
|
| 40 |
+
st.write(response)
|
| 41 |
+
elif submit2:
|
| 42 |
+
if uploaded_file is not None:
|
| 43 |
+
pdf_content = input_pdf_setup(uploaded_file)
|
| 44 |
+
response = get_gemini_response(PROMPT_SKILL_IMPROVEMENTS, pdf_content, input_text)
|
| 45 |
+
st.subheader("Skill Improvement Recommendations:")
|
| 46 |
+
st.write(response)
|
| 47 |
+
elif submit3:
|
| 48 |
+
if uploaded_file is not None:
|
| 49 |
+
pdf_content = input_pdf_setup(uploaded_file)
|
| 50 |
+
response = get_gemini_response(PROMPT_ACCEPTANCE_PERCENTAGE, pdf_content, input_text)
|
| 51 |
+
st.subheader("ATS System Evaluation:")
|
| 52 |
+
st.write(response)
|
| 53 |
+
st.success('Done!')
|
| 54 |
+
|
| 55 |
+
if __name__ == "__main__":
|
| 56 |
+
main()
|
prompt.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PROMPT_RESUME_ABOUT = """
|
| 2 |
+
As an experienced Technical HR Manager, assess the candidate's resume against the job description. Provide a detailed analysis:
|
| 3 |
+
1. **Strengths and Weaknesses:**
|
| 4 |
+
- Highlight relevant skills, experience, and qualifications.
|
| 5 |
+
- Identify areas that may need improvement.
|
| 6 |
+
|
| 7 |
+
2. **Alignment Feedback:**
|
| 8 |
+
- Offer constructive feedback on how well the resume aligns with role expectations.
|
| 9 |
+
|
| 10 |
+
Your thorough assessment guides an informed decision on the candidate's suitability for the position.
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
PROMPT_SKILL_IMPROVEMENTS = """
|
| 14 |
+
As a seasoned Technical HR Manager, guide individuals seeking skill enhancement for a specific technical role. Provide insights on:
|
| 15 |
+
|
| 16 |
+
1. **Job-Specific Technical Skills:**
|
| 17 |
+
- Analyze and advise on skills directly related to job requirements.
|
| 18 |
+
|
| 19 |
+
2. **Relevant Learning Resources:**
|
| 20 |
+
- Recommend courses and resources aligning with technical needs.
|
| 21 |
+
|
| 22 |
+
3. **Customized Skill Development:**
|
| 23 |
+
- Propose personalized plans for skill acquisition and reinforcement.
|
| 24 |
+
|
| 25 |
+
Tailor advice to job specifics for targeted skill improvement aligned with career goals.
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
PROMPT_ACCEPTANCE_PERCENTAGE = """
|
| 29 |
+
As an adept ATS scanner, evaluate resumes against job descriptions:
|
| 30 |
+
|
| 31 |
+
1. **Percentage of Match:**
|
| 32 |
+
- Calculate alignment percentage between resume and job description.
|
| 33 |
+
|
| 34 |
+
2. **Keywords Missing:**
|
| 35 |
+
- Identify and list absent keywords or skills from the job description.
|
| 36 |
+
|
| 37 |
+
3. **Final Thoughts:**
|
| 38 |
+
- Provide constructive feedback on strengths and suggestions for improvement.
|
| 39 |
+
|
| 40 |
+
Get a comprehensive evaluation with a clear match percentage, identified missing keywords, and valuable insights for both the candidate and the ATS system.
|
| 41 |
+
"""
|
utils.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import google.generativeai as genai
|
| 3 |
+
import pdf2image
|
| 4 |
+
import io
|
| 5 |
+
import base64
|
| 6 |
+
from dotenv import load_dotenv
|
| 7 |
+
|
| 8 |
+
load_dotenv()
|
| 9 |
+
|
| 10 |
+
genai.configure(api_key= os.environ['GOOGLE_API_KEY'])
|
| 11 |
+
|
| 12 |
+
def get_gemini_response(prompt, pdf_content, input):
|
| 13 |
+
model = genai.GenerativeModel('gemini-pro-vision')
|
| 14 |
+
data = [prompt]+ pdf_content + [input]
|
| 15 |
+
response = model.generate_content(data)
|
| 16 |
+
return response.text
|
| 17 |
+
|
| 18 |
+
def input_pdf_setup(uploaded_file):
|
| 19 |
+
if uploaded_file is not None:
|
| 20 |
+
## Convert the PDF to image
|
| 21 |
+
images=pdf2image.convert_from_bytes(
|
| 22 |
+
uploaded_file.read(),
|
| 23 |
+
poppler_path= os.environ["PATH_POPPLER"]# for windows if resulting error
|
| 24 |
+
)
|
| 25 |
+
# first_page=images[0]
|
| 26 |
+
pdf_parts = []
|
| 27 |
+
|
| 28 |
+
for page_num, image in enumerate(images):
|
| 29 |
+
# Convert to bytes
|
| 30 |
+
img_byte_arr = io.BytesIO()
|
| 31 |
+
image.save(img_byte_arr, format='JPEG')
|
| 32 |
+
img_byte_arr = img_byte_arr.getvalue()
|
| 33 |
+
|
| 34 |
+
pdf_part = {
|
| 35 |
+
# "page_number": page_num + 1, # Page numbers usually start from 1
|
| 36 |
+
"mime_type": "image/jpeg",
|
| 37 |
+
"data": base64.b64encode(img_byte_arr).decode()
|
| 38 |
+
}
|
| 39 |
+
data = [pdf_part]
|
| 40 |
+
|
| 41 |
+
pdf_parts+=data
|
| 42 |
+
|
| 43 |
+
return pdf_parts
|
| 44 |
+
else:
|
| 45 |
+
raise FileNotFoundError("No file uploaded")
|