ATSmatch / app.py
Vaishvik1618's picture
Update app.py
bf866a6 verified
import streamlit as st
import fitz # PyMuPDF
import google.generativeai as genai
# Configure the Generative AI model
genai.configure(api_key="AIzaSyBqPmsZAJrCsXme9wJBx9o4K71M9c1qzy8")
def ai_output(input_text, pdf_text, prompt):
model = genai.GenerativeModel('gemini-1.5-flash')
combined_input = f"{input_text}\n\n{pdf_text}\n\n{prompt}"
response = model.generate_content(combined_input)
return response.text
def ai_ans(input_text, prompt):
model = genai.GenerativeModel('gemini-1.5-flash')
combined_input = f"{input_text}\n\n{prompt}"
response = model.generate_content(combined_input)
return response.text
def input_pdf_setup(uploaded_file):
if uploaded_file is not None:
pdf_document = fitz.open(stream=uploaded_file.read(), filetype="pdf")
text = ""
for page_num in range(len(pdf_document)):
page = pdf_document.load_page(page_num)
text += page.get_text()
pdf_document.close()
return text
else:
raise FileNotFoundError("No file uploaded")
st.set_page_config(page_title="ATS Resume Expert")
st.header("HARIMAY ATS Tracking System")
input_text = st.text_area("Job Description:", key="input")
uploaded_file = st.file_uploader("Upload your resume (PDF)...", type=["pdf"])
job_role = st.text_input("Enter Job Role", key="job")
if uploaded_file is not None:
pdf_text = input_pdf_setup(uploaded_file)
st.write("PDF file uploaded and processed successfully.")
else:
pdf_text = ""
st.write("Please upload the resume.")
submit1 = st.button("Tell me about the Resume")
submit2 = st.button("Percentage Match")
submit3 = st.button("Job Skills")
submit4 = st.button("Missing Keywords")
input_prompt1 = """
You are an experienced Technical Human Resource Manager. Your task is to review the provided resume against the 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 specified job requirements.
"""
input_prompt2 = """
You are a skilled ATS (Applicant Tracking System) scanner with a deep understanding of ATS functionality.
Your task is to evaluate the resume against the provided job description. Provide the percentage match if the resume aligns
with the job description. First, present the output as a percentage, then list missing keywords, and finally, offer your thoughts.
"""
input_prompt3 = """
You are an advanced career advisor and job market expert with deep insights into various industries. When given a job role, your task is to identify and list the key skills and qualifications that are most commonly required for success in that position. Please provide a structured output that includes:
1. A detailed list of technical and hard skills.
2. A summary of soft skills crucial for the role.
3. Recommended educational qualifications and certifications associated with the job.
"""
input_prompt4 = """
You are an expert in resume optimization and keyword integration for job applications. I am providing my resume content along with a job description. Your task is to analyze the resume and identify any important keywords or skills from the job description that are missing in my resume. For each missing keyword or skill, provide the following:
1.A clear explanation of all the missing keyword or skill and why it is important for the role.
2.A detailed suggestion for a sentence or bullet point that can be added to the resume to include the missing keyword.
3.Guidance on where in the resume (e.g., Professional Experience, Skills, Education, Projects) the new content should be inserted for the best impact.
Ensure that the suggestions are tailored to the context of my existing resume, maintaining a natural flow and relevance to my career background
and also tell that you experience is less that what this job is expected
also get the list of missing keywords
and tell me why I would not select for an interview for this position according to my resume
"""
if submit1:
if pdf_text:
response = ai_output(input_text, pdf_text, input_prompt1)
st.subheader("The Response is:")
st.write(response)
else:
st.write("Please upload the resume.")
elif submit2:
if pdf_text:
response = ai_output(input_text, pdf_text, input_prompt2)
st.subheader("The Response is:")
st.write(response)
else:
st.write("Please upload the resume.")
elif submit3:
response = ai_ans(job_role, input_prompt3)
st.subheader("The Response is:")
st.write(response)
elif submit4:
if pdf_text:
response = ai_output(input_text, pdf_text, input_prompt4)
st.subheader("Missing things which need to be present in your resume:")
st.write(response)