DEV Community

Cover image for Building an ATS Resume Matching Tool with Google Generative AI
Om Ghumre
Om Ghumre

Posted on

Building an ATS Resume Matching Tool with Google Generative AI

Introduction

In today's competitive job market, having a resume that stands out is crucial. To help job seekers optimize their resumes, I recently created a Resume ATS Percentage Match Tool. This tool compares your resume against a job description and provides tips for improvement. It's built using Streamlit, Google Generative AI, and various Python libraries. In this blog post, I'll walk you through the project, its functionalities, and the technologies used.

Project Overview

The ATS Resume Matching Tool is a web application that allows users to upload their resumes in PDF format and paste a job description. The tool then evaluates the resume against the job description, providing a professional evaluation and a percentage match. It also highlights the strengths and weaknesses of the resume, helping users tailor their resumes to specific job requirements.

Technologies Used

  • Streamlit: A Python library used to create the web application interface.
  • Python Libraries: dotenv, io, base64, os, PIL, pdf2image, and google.generativeai.
  • Google Generative AI: Used to generate responses based on the resume and job description.
  • PDF2Image: Converts PDF files to images for processing.

Code Walkthrough

Here's a breakdown of the code used to build this tool.

1. Setting Up Environment Variables

We use the dotenv library to load environment variables, including the Google API key:

from dotenv import load_dotenv
load_dotenv()
Enter fullscreen mode Exit fullscreen mode

2. Importing Libraries

We import the necessary libraries for the project:

import streamlit as st 
import io 
import base64
import os 
from PIL import Image 
import pdf2image
import google.generativeai as genai
Enter fullscreen mode Exit fullscreen mode

3. Configuring Google Generative AI

We configure the Google Generative AI with the API key:

genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
Enter fullscreen mode Exit fullscreen mode

4. Generating Responses

We define a function to get responses from the Google Generative AI:

def get_gemini_response(input, pdf_content, propmt):
    model=genai.GenerativeModel('gemini-pro-vision')
    response = model.generate_content([input, pdf_content[0], propmt])
    return response.text
Enter fullscreen mode Exit fullscreen mode

5. Handling PDF Upload

We define a function to handle the uploaded PDF file, converting the first page to an image:

def input_pdf_setup(uploaded_file):
    if uploaded_file is not None:
        images = pdf2image.convert_from_bytes(uploaded_file.read())
        first_page = images[0]
        img_byte_arr = io.BytesIO()
        first_page.save(img_byte_arr, format='JPEG')
        img_byte_arr = img_byte_arr.getvalue()
        pdf_parts = [
            {
                "mime_type": "image/jpeg",
                "data": base64.b64encode(img_byte_arr).decode()
            }
        ]
        return pdf_parts
    else:
        raise FileNotFoundError("No file uploaded")
Enter fullscreen mode Exit fullscreen mode

6. Creating the Streamlit App

We create the Streamlit app interface:

st.set_page_config(page_title="ATS Resume Expert")
st.header("ATS Tracking System")
input_text = st.text_area("Job Description: ", key="input")
uploaded_file = st.file_uploader("Upload your resume (PDF)...", type=["pdf"])

if uploaded_file is not None:
    st.write("File uploaded successfully")

submit1 = st.button("Tell Me About the Resume")
submit2 = st.button("Percentage Match")

input_prompt1 = """ 
You are a highly experienced Technical Human Resource Manager. Your task is to review the provided resume against the specified job description. Please share your professional evaluation on whether the candidate's profile aligns with the role. Highlight the strengths and weaknesses of the applicant in relation to the job requirements. Your evaluation should include an assessment of relevant skills, experience, and any gaps or areas for improvement.
"""

input_prompt2 = """
You are a highly skilled ATS (Applicant Tracking System) scanner with a deep understanding of data science and ATS functionality. Your task is to evaluate the provided resume against the specified job description. First, provide the percentage match between the resume and the job description. Then, list the missing keywords. Finally, share your thoughts on the alignment of the resume with the job requirements, including an assessment of relevant skills, experience, and any areas for improvement.
"""

if submit1:
    if uploaded_file is not None:
        pdf_content = input_pdf_setup(uploaded_file)
        response = get_gemini_response(input_prompt1, pdf_content, input_text)
        st.subheader("The Response is")
        st.write(response)
    else:
        st.write("Please upload the resume")

elif submit2:
    if uploaded_file is not None:
        pdf_content = input_pdf_setup(uploaded_file)
        response = get_gemini_response(input_prompt2, pdf_content, input_text)
        st.subheader("The Response is")
        st.write(response)
    else:
        st.write("Please upload the resume")
Enter fullscreen mode Exit fullscreen mode

Conclusion

The ATS Resume Matching Tool is a powerful application that leverages the capabilities of Streamlit and Google Generative AI to help job seekers optimize their resumes. By providing a detailed evaluation and a percentage match, it guides users in tailoring their resumes to specific job descriptions, increasing their chances of landing their desired jobs. Try building this tool yourself and see how it can benefit your job search process!

Special thanks to Krish Naik for their invaluable guidance and insights.

You can find the complete code for this project on my GitHub: GitHub Repository.


I hope you found this walkthrough insightful. If you have any questions or need further assistance, feel free to reach out!

Top comments (0)