ATS_System / app.py
funnyPhani's picture
Update app.py
91b6b4c verified
# ATS
import os
import PyPDF2 as pdf
import streamlit as st
from dotenv import load_dotenv
import google.generativeai as genai
from PIL import Image
# Load environment variables
load_dotenv()
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
genai.configure(api_key=GOOGLE_API_KEY)
model = genai.GenerativeModel(model_name='gemini-1.5-flash')
st.set_page_config(page_title="Smart Application Tracking System", page_icon=":robot:")
st.title("SMART APPLICATION TRACKING SYSTEM")
st.text("Improve Your Resume ATS Score")
# Job description input
jd_option = st.radio(
"How would you like to provide the Job Description?",
("Text Input", "Upload Image")
)
jd = None
if jd_option == "Text Input":
jd = st.text_area("Paste the Job Description")
else:
jd_image = st.file_uploader("Upload Job Description Image", type=["png", "jpg", "jpeg"], help="Please upload the job description image.")
if jd_image is not None:
jd_image_opened = Image.open(jd_image)
jd = jd_image_opened # Assuming that the API can handle image input directly
# Resume upload
uploaded_file = st.file_uploader("Upload Your Resume", type="pdf", help="Please upload the PDF")
submit = st.button("Submit")
if submit:
if uploaded_file is not None and jd is not None:
# Extract text from the PDF resume
reader = pdf.PdfReader(uploaded_file)
extracted_text = ""
for page in range(len(reader.pages)):
page = reader.pages[page]
extracted_text += str(page.extract_text())
# Create the prompt
input_prompt = f"""
You are an advanced Applicant Tracking System (ATS) with deep expertise in the fields of software engineering, data science, data analysis, and big data engineering. Your primary task is to meticulously evaluate the provided resume against the given job description. The evaluation must account for the highly competitive job market, and you should offer valuable insights for improving the resume's relevance to the job description.
Your response should focus on the following three areas:
1. **Job Description Match:**
Provide a percentage match score based on how well the resume aligns with the job description. This score should consider the candidate's skills, experience, and qualifications in relation to the job requirements.
2. **Missing Keywords:**
Identify and list the key terms and phrases from the job description that are missing from the resume. Highlight those that are critical to the job and may significantly impact the resume's match score.
3. **Profile Summary:**
Create a concise and impactful profile summary based on the information extracted from the resume. The summary should highlight the candidate's most relevant skills, experience, and achievements in a manner that aligns with the job description.
Resume: {extracted_text}
Job Description: {jd if isinstance(jd, str) else "Job Description Image"}
"""
if isinstance(jd, str):
response = model.generate_content([input_prompt])
else:
response = model.generate_content([input_prompt, jd])
st.write(response.text)
else:
st.error("Please upload both a resume and a job description.")