Recruiters often spend significant time reviewing resumes to identify suitable candidates. An AI Resume Analyzer simplifies this process by automatically analyzing a resume and providing useful insights within seconds. In this tutorial, you will build a simple AI Resume Analyzer using Python, Streamlit, and an AI API. The application will allow users to upload a PDF resume, analyze its content, and generate a professional report that highlights strengths, missing skills, ATS compatibility, and improvement suggestions.
Table of Contents
Prerequisites
Before starting the project, make sure you have the following requirements in place.
1. Python: Install the latest version of Python on your computer. After installation, verify it by running the following command:
2. Visual Studio Code: Use Visual Studio Code or any Python IDE of your choice to write and run the project. Installing the Python extension in VS Code will make development easier.python --version
3. AI API Key: Create an API key from your preferred AI provider. You will use this key later to authenticate requests and analyze resumes.
Note:
4. Basic Python Knowledge: A basic understanding of Python, including variables, functions, and importing libraries, is sufficient to complete this project.Never expose your API key in your source code or public repositories.
Project Overview
The Resume Analyzer accepts a PDF resume, extracts its content, sends it to an AI model, and displays a detailed analysis. Instead of only reading the resume, the AI provides meaningful feedback that can help improve it.Features of the Application
- Resume Upload: Users can upload their resume in PDF format through a simple web interface.
- Resume Analysis: The uploaded resume is analyzed using an AI model to identify important information and evaluate the overall quality.
- ATS Compatibility Score: The application generates an estimated ATS score to indicate how well the resume may perform in Applicant Tracking Systems.
- Improvement Suggestions: The AI recommends improvements such as missing skills, better formatting, and additional information that can strengthen the resume.
- Suitable Job Roles: Based on the resume content, the application suggests job roles that best match the candidate's skills and experience.
Application Workflow
The application follows a simple four-step workflow.- Upload a PDF Resume: The user selects and uploads a resume in PDF format through the Streamlit web interface.
- Extract Resume Text: The application reads the uploaded PDF and extracts its text using the PyPDF library.
- Send Text to AI API: The extracted resume content is sent to the AI model along with a prompt for analysis.
- Display the Generated Analysis: The AI-generated report, including the summary, strengths, missing skills, ATS score, and improvement suggestions, is displayed in the application.
Step 1: Set Up the Project
Now let's prepare the development environment.1. Create the Project Folder: Create a new folder named AI-Resume-Analyzer and open it in Visual Studio Code.
2. Create a Virtual Environment: Create a virtual environment to keep the project's dependencies isolated.AI-Resume-Analyzer
Activate it using the appropriate command.python -m venv venv
Windows
macOS/Linuxvenv\Scripts\activate
3. Install the Required Libraries: Install the libraries required for this project.source venv/bin/activate
Each library serves a specific purpose.pip install streamlit openai python-dotenv pypdf
- Streamlit: Streamlit is used to create the web interface where users can upload resumes and view the analysis.
- OpenAI: The OpenAI library allows the application to communicate with the AI API and generate resume insights.
- Python-dotenv: This library loads environment variables from a .env file, allowing you to store your API key securely.
- PyPDF: PyPDF extracts text from uploaded PDF resumes so it can be analyzed by the AI model.
app.py: This is the main application file that contains the Streamlit interface and the application logic.AI-Resume-Analyzer/
│
├── app.py
├── .env
├── requirements.txt
└── README.md
.env: Store your API key in this file.
Replace your_api_key_here with your actual API key.OPENAI_API_KEY=your_api_key_here
requirements.txt: Add the project dependencies to this file.
This allows anyone to install the required libraries using:streamlit
openai
python-dotenv
pypdf
pip install -r requirements.txt
Step 2: Upload and Read the Resume
Now that the project setup is complete, let's build the part of the application that allows users to upload a resume. Once the resume is uploaded, we will extract its text so it can be analyzed by the AI model.1. Import the Required Libraries: Start by importing the libraries that will be used throughout the application by adding the following imports to your app.py file.
import streamlit as st from pypdf import PdfReader from openai import OpenAI from dotenv import load_dotenv import osThese libraries handle different parts of the application. Streamlit creates the web interface, PyPDF reads the uploaded resume, OpenAI communicates with the AI API, and python-dotenv loads the API key from the .env file.
2. Load the API Key: Load the environment variables and create an OpenAI client.
load_dotenv()
client = OpenAI(
api_key=os.getenv("OPENAI_API_KEY")
)
This code reads the API key stored in the .env file and initializes the AI client. Using environment variables keeps your API key secure and prevents it from being exposed in your source code.3. Create the Application Title: Now update your app.py file by adding the following code. Add a title and a short description to the application.
st.title("AI Resume Analyzer")
st.write(
"Upload your resume and receive an AI-powered analysis with strengths, missing skills, ATS score, and improvement suggestions."
)
This creates a simple and user-friendly interface that explains the purpose of the application.4. Add a File Uploader: Next, allow users to upload their resume.
uploaded_file = st.file_uploader(
"Upload your resume (PDF)",
type=["pdf"]
)
The file_uploader() widget opens a file selection dialog and accepts only PDF files. If the user uploads a file in another format, Streamlit will reject it automatically.5. Read the Uploaded Resume: After the user uploads a resume, extract its text using PyPDF.
resume_text = ""
if uploaded_file is not None:
pdf = PdfReader(uploaded_file)
for page in pdf.pages:
resume_text += page.extract_text()
This code performs the following tasks:
- Reads the uploaded PDF.
- Loops through every page.
- Extracts the text from each page.
- Combines all extracted text into a single string.
6. Verify the Extracted Text: Before sending the resume to the AI, verify that the text has been extracted successfully.
if uploaded_file is not None:
st.subheader("Extracted Resume Text")
st.text_area(
"Resume Content",
resume_text,
height=300
)
Displaying the extracted text helps you confirm that the PDF was read correctly. During development, this also makes debugging much easier if the resume does not contain the expected content.
Step 3: Analyze the Resume Using an AI API
After extracting the resume text, the next step is to send it to the AI model for analysis. Instead of simply displaying the resume, the AI will evaluate its content and generate useful feedback. Now update the same app.py file by adding the following code below the previous section.
if uploaded_file:
prompt = f"""
Analyze the following resume.
Provide:
- Professional Summary
- Key Strengths
- Missing Skills
- ATS Score
- Improvement Suggestions
- Suitable Job Roles
Resume:
{resume_text}
"""
response = client.responses.create(
model="gpt-4.1-mini",
input=prompt
)
analysis = response.output_text
st.subheader("Resume Analysis")
st.markdown(analysis)
At this point, app.py contains a complete working application that can upload a PDF, extract its text, send it to the AI API, and display the generated analysis.
Step 4: Run and Test the Application
Now that the AI Resume Analyzer is complete, the final step is to run the application and verify that every feature works correctly.1. Run the Streamlit Application: Open the terminal in Visual Studio Code, navigate to your project directory, and execute the following command.
This command starts the Streamlit development server and launches the application in your default web browser. If the browser does not open automatically, copy the local URL displayed in the terminal and open it manually.streamlit run app.py
2. Upload a Resume: After the application opens, click the Upload your Resume button and select a PDF resume from your computer. The application accepts only PDF files. Once the upload is complete, the resume text is extracted automatically and prepared for AI analysis.
3. View the AI-Generated Analysis: After the resume is processed, the application sends the extracted text to the AI API. Within a few seconds, the generated analysis appears on the screen. The report includes information such as:
- Professional summary
- Key strengths
- Missing skills
- Resume improvement suggestions
- Estimated ATS score
- Suitable job roles
Common Errors and Solutions
While building this project, you may encounter some common issues. The following solutions can help you troubleshoot and resolve them quickly.1. Invalid or Missing API Key: If the API key is incorrect or missing, the application will fail to communicate with the AI API and return an authentication error.
Solution: Ensure that the API key is correctly stored in the .env file and that the python-dotenv library loads it before creating the OpenAI client.
2. PDF Text Is Not Extracted: Some resumes are scanned documents or image-based PDFs, which cannot be read directly using PyPDF.
Solution: Use a text-based PDF or convert the scanned document into a searchable PDF using an OCR (Optical Character Recognition) tool before uploading it.
3. ModuleNotFoundError: This error occurs when one or more required Python libraries are not installed in your environment.
Solution: Install all project dependencies by running the following command:
4. Empty or Incomplete AI Response: If the extracted resume text is empty or the API request fails, the AI may return an incomplete or empty response.pip install -r requirements.txt
Solution: Verify that the resume contains readable text and confirm that your internet connection and API key are working correctly.
5. Rate Limit Exceeded: Sending too many requests within a short period may exceed your API provider's rate limit.
Solution: Wait for the rate limit to reset or review your API usage and billing information in your provider's dashboard.
6. Slow Response Time: Large resumes or network delays may increase the time required to generate the analysis.
Solution: Wait for the request to complete or use shorter resumes during testing to reduce processing time.
Conclusion
In this tutorial, you built an AI Resume Analyzer using Python, Streamlit, and an AI API. The application allows users to upload a PDF resume, extract its content, send it to an AI model, and generate a professional analysis containing a summary, key strengths, missing skills, improvement suggestions, an estimated ATS score, and suitable job roles.This project demonstrates how AI APIs can be integrated into practical applications with minimal code. As you continue learning, you can extend this project by supporting additional file formats, integrating job matching, comparing multiple resumes, or adding interview preparation features to create a more advanced AI-powered recruitment solution.
Frequently Asked Questions
1. Which resume formats are supported by this application?2. Can I use a different AI provider?The current implementation supports PDF resumes. You can extend the project to support DOCX or TXT files by using suitable Python libraries.
3. How can I improve the ATS score analysis?Yes. You can use any AI provider that offers a compatible API. You only need to update the client initialization and API request according to the provider's documentation.
4. Can I deploy this application online?You can combine AI-generated feedback with keyword matching, formatting checks, and job-specific skill validation to generate a more comprehensive ATS evaluation.
5. What features can I add to this project?Yes. You can deploy the application on platforms such as Streamlit Community Cloud, Render, Railway, or Azure App Service to make it accessible through a web browser.
You can enhance the application by adding support for multiple file formats, resume comparison, job recommendations, interview question generation, user authentication, or resume history.
0 Comments