-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
356 lines (274 loc) · 19.3 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
import pybase64
import io
from dotenv import load_dotenv
import pymongo
from pymongo import MongoClient
import os
import streamlit as st
import os
from PIL import Image
import PyPDF2 as pdf
import google.generativeai as genai
import time
from database import x
load_dotenv()
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
def get_gemini_response(input):
model = genai.GenerativeModel('gemini-pro')
response = model.generate_content(input)
return response.text
def input_pdf_text(uploaded_file):
reader = pdf.PdfReader(uploaded_file)
text = ""
for page in reader.pages:
text += page.extract_text() or '' # Ensure text is not None
return text
## ------- Streamlit app setup ---------
st.set_page_config(page_title="ATSPro", page_icon="📑", layout = 'wide')
with open( "styles/main.css" ) as css:
st.markdown( f'<style>{css.read()}</style>' , unsafe_allow_html= True)
st.title("ATSPro: The ATS-Conquering Companion")
st.subheader("Cross the ATS Hurdle: Unlock Your Career Potential with Precision and Insight")
#Set BAckground Image
def set_bg_image(image_file):
with open(image_file, "rb") as file:
# Use base64 to encode the image file
encoded_image = pybase64.b64encode(file.read()).decode()
# Set the background using CSS styles
css_style = f"""
<style>
.stApp {{
background-image: url("data:image/png;base64,{encoded_image}");
background-size: cover;
background-position: center;
}}
</style>
"""
st.markdown(css_style, unsafe_allow_html=True)
set_bg_image("background.JPG")
#App Code
st.write("""_**ATSPro**_ is your strategic ally in mastering the **Applicant Tracking System (ATS)** challenge, powered by the advanced capabilities of _**Google Gemini Pro**_. This ATS Expert System is crafted to refine and align your resume with precision, ensuring it resonates with both the ATS algorithms and human recruiters' expectations.
Through a deep analysis of your resume against specific job descriptions, _**ATSPro**_ identifies key areas for enhancement, from keyword optimization to structural improvements, making your application ATS-friendly. Our unique feature set also includes generating custom interview questions and answers, tailored to your resume and the job you're targeting, ensuring you're well-prepared for both technical and HR evaluations.""")
st.write("**Note:** _**ATSPro**_ can make mistakes. Consider checking important information.")
# Initialize session state variables for button clicks
if 'submit1_clicked' not in st.session_state:
st.session_state['submit1_clicked'] = False
if 'submit2_clicked' not in st.session_state:
st.session_state['submit2_clicked'] = False
if 'submit3_clicked' not in st.session_state:
st.session_state['submit3_clicked'] = False
if 'submit4_clicked' not in st.session_state:
st.session_state['submit4_clicked'] = False
if 'submit5_clicked' not in st.session_state:
st.session_state['submit5_clicked'] = False
# Define button click callbacks to set state
def on_submit1_clicked():
st.session_state['submit1_clicked'] = True
def on_submit2_clicked():
st.session_state['submit2_clicked'] = True
def on_submit3_clicked():
st.session_state['submit3_clicked'] = True
def on_submit4_clicked():
st.session_state['submit4_clicked'] = True
def on_submit5_clicked():
st.session_state['submit5_clicked'] = True
# Role input
role = st.text_input("**What's the Job Role?**")
# Job description and resume upload
jd = st.text_area("**Paste the Job Description**")
uploaded_file = st.file_uploader("**Upload Your Resume**", type="pdf", help="Please upload a pdf")
col1, col2, col3, col4, col5 = st.columns(5)
# Display buttons and check their state
with col1:
submit1 = st.button("Tell Me About My Resume ", on_click=on_submit1_clicked,type="primary")
with col2:
submit2 = st.button("Percentage(%) Match ", on_click=on_submit2_clicked,type="primary")
with col3:
submit3 = st.button("How to Improve Skills", on_click=on_submit3_clicked,type="primary")
with col4:
submit4 = st.button("Customization Tips", on_click=on_submit4_clicked,type="primary")
with col5:
submit5 = st.button("Interview Prep Guide", on_click=on_submit5_clicked,type="primary")
# Process button clicks
if submit1 and st.session_state['submit1_clicked']:
if len(role) > 0:
if uploaded_file is not None:
text = input_pdf_text(uploaded_file)
if len(jd) > 0:
with st.spinner('Please Wait..'):
prompt1 = f"""
You are a professional and experienced ATS(Application Tracking System) with a deep understanding of {role} fields. Analyze the provided resume and job description (JD). Provide a detailed analysis (200-300 words) of how the resume aligns with the JD, highlighting key areas of strength, relevant experiences, and qualifications. Discuss any notable achievements or skills that are particularly well-matched to the job requirements.
Here is the resume content : {text}
Here is the job description : {jd}
Your Response Should have the following structure
Example:
Note: Only Mention and Analyze the content of the provided resume text. Make sure Nothing additional is added outside the provided text
Resume Analysis and Alignment with Job Description:
Overview:
The resume presents a strong background in software engineering, with a particular emphasis on full-stack development and cloud technologies.
Strengths:
- Technical Proficiency: Proficient in key programming languages such as Python, JavaScript, and Java, aligning well with the job's technical requirements.
- Project Experience: Showcases several projects that demonstrate the ability to design, develop, and deploy scalable software solutions, mirroring the JD's emphasis on hands-on experience.
Relevant Experiences: (Highlight only the things that are present in the resume.)
- Lead Developer Role: Led a team in developing a SaaS application using microservices architecture, directly relevant to the job's focus on leadership and microservices.
- Cloud Solutions Architect: Experience in designing cloud infrastructure on AWS, aligning with the JD's requirement for cloud computing skills.
"""
response = get_gemini_response(prompt1)
st.write(response) # Use st.write to display the response
else:
st.error("No job description provided.")
else:
st.error("No job description provided.")
st.error("Resume Not Uploaded.")
else:
st.error("No Job Role Specified")
st.error("No job description provided.")
st.error("Resume Not Uploaded.")
if submit2 and st.session_state['submit2_clicked']:
if len(role) > 0:
if uploaded_file is not None:
text = input_pdf_text(uploaded_file)
if len(jd) > 0:
with st.spinner('Please Wait..'):
prompt2 = f"""
You are a professional and experienced ATS(Application Tracking System) focused exclusively on the {role} field. Your task is to evaluate the resume strictly based on the provided job description and resume content. It is critical to only identify and list the keywords and phrases that have a direct match between the resume and the JD. Highlight any crucial keywords or skills required for the job that are absent in the resume. Based on your analysis, provide a percentage match.
Important: Your analysis must strictly adhere to the content provided below. Do not infer or add any keywords, skills, or technologies not explicitly mentioned in these texts. Re-evaluate the texts to ensure accuracy. Recheck before you provide your response
Resume Content: {text}
Job Description: {jd}
Never provide anything which is neither present in resume content nor job description.
Output should strictly follow this structure:
Percentage Match: [Provide percentage]
Matched Keywords:
- Skills: [List only the matched skills found in both the job description and resume content. recheck before you provide your response]
- Technologies: [List only the matched technologies found in both the job description and resume. Recheck before you provide your response]
- Methodologies: [List only the matched methodologies found in both the job description and resume. Recheck before you provide your response]
Missing Keywords:
- [List the skills or technologies crucial for the role found in the job description but not in the resume. Recheck before you provide your response]
Final Thoughts:
- [Provide a brief assessment focusing on the alignment, matched keywords, missing elements, and percentage match. Reinforce the instruction to only mention elements present in the provided texts. Recheck before you provide your response]
"""
response = get_gemini_response(prompt2)
st.subheader("Percentage Match Analysis")
st.write(response) # Use st.write to display the response
else:
st.error("No job description provided.")
else:
st.error("No job description provided.")
st.error("Resume Not Uploaded.")
else:
st.error("No Job Role Specified")
st.error("No job description provided.")
st.error("Resume Not Uploaded.")
if submit3 and st.session_state['submit3_clicked']:
if len(role) > 0:
if uploaded_file is not None:
text = input_pdf_text(uploaded_file)
if len(jd) > 0:
with st.spinner('Please Wait..'):
prompt3 = f"""
You are a professional and experienced ATS(Application Tracking System) with a deep understanding of {role} fields. Based on the analysis of the resume and the job description, suggest specific improvements and additions to the candidate's skill set (200-300 words). Identify areas where the candidate falls short and recommend actionable steps or resources for acquiring or enhancing the necessary skills. Highlight the importance of these skills in the context of the targeted job role.
Here is the resume content : {text}
Here is the job description : {jd}
Your Response Should have the following structure
Example:
Note: Only Mention and Analyze the content of the provided resume text. Make sure Nothing additional is added outside the provided text
Skills Improvement and Addition Suggestions:
To further align your resume with the job requirements and the evolving trends in software engineering, consider the following improvements:
Expand Knowledge in Emerging Technologies:
- Dive into Machine Learning and Big Data Analytics; consider online courses or projects that demonstrate practical application.
- Familiarize yourself with Blockchain Technology, given its growing impact on secure and decentralized systems.
Enhance Cloud Computing Skills:
- Gain deeper expertise in cloud services beyond AWS, such as Microsoft Azure or Google Cloud Platform, to showcase versatility.
- Strengthen Soft Skills:
Leadership and project management skills are highly valued; consider leading more projects or taking courses in Agile and Scrum methodologies.
"""
response = get_gemini_response(prompt3)
st.subheader("Skills Improvement Suggestions")
st.write(response)
else:
st.error("No job description provided.")
else:
st.error("No job description provided.")
st.error("Resume Not Uploaded.")
else:
st.error("No Job Role Specified")
st.error("No job description provided.")
st.error("Resume Not Uploaded.")
if submit4 and st.session_state['submit4_clicked']:
if len(role) > 0:
if uploaded_file is not None:
text = input_pdf_text(uploaded_file)
if len(jd) > 0:
with st.spinner('Please Wait..'):
prompt4 = f"""
You are a professional and experienced ATS(Application Tracking System) with a deep understanding of {role} fields. Review the resume's bullet points in light of the job description. Provide targeted suggestions on how to edit existing bullet points to better align with the job requirements. Focus on enhancing clarity, relevance, and impact by incorporating keywords from the JD and emphasizing achievements and skills that are most pertinent to the job.
Here is the resume content : {text}
Here is the job description : {jd}
Your Response Should have the following structure
Example:
Note: Only Mention and Analyze the content of the provided resume text. Make sure Nothing additional is added outside the provided text
Resume Customization Tips for Better Alignment with Job Description:
Tailor Bullet Points:
- Current: "Developed a web application using React and Node.js."
- Revised: "Engineered a scalable web application using React and Node.js, incorporating microservices architecture to enhance modularity and deployability, directly supporting team objectives in agile development environments."
Highlight Specific Achievements:
- Current: "Designed cloud infrastructure for various projects."
- Revised: "Strategically designed and deployed robust cloud infrastructure on AWS for 3 enterprise-level projects, achieving a 20% improvement in deployment efficiency and cost reduction."
Incorporate Missing Keywords:
If you have experience with Machine Learning, add a bullet point like: "Implemented machine learning algorithms to automate data processing tasks, resulting in a 30% reduction in processing times."
"""
response = get_gemini_response(prompt4)
st.subheader("Customization Tips")
st.write(response)
else:
st.error("No job description provided.")
else:
st.error("No job description provided.")
st.error("Resume Not Uploaded.")
else:
st.error("No Job Role Specified")
st.error("No job description provided.")
st.error("Resume Not Uploaded.")
if submit5 and st.session_state['submit5_clicked']:
if len(role) > 0:
if uploaded_file is not None:
text = input_pdf_text(uploaded_file)
if len(jd) > 0:
with st.spinner('Please Wait..'):
prompt5 = f"""
You are a professional and experienced ATS(Application Tracking System) with a deep understanding of {role} fields. Analyze the provided resume and job description (JD). Generate a set of interview questions and suggested answers tailored to this specific context. The questions should be designed to explore the candidate's technical skills, experiences, and personal attributes relevant to the role, as described in the JD and evidenced in the resume. Provide 5 technical interview questions (1 easy question, 2 medium questions, 3 hard questions) focusing on the key skills and technologies mentioned in the JD and resume. The technical questions should sound specific and technical. Additionally, provide 5 HR interview questions (1 easy question, 2 medium questions, 3 hard questions) that probe into the candidate's behavioral traits, problem-solving abilities, and cultural fit for the organization. For each question, include a detailed sample answer that highlights how the candidate can effectively showcase their relevant skills, experiences, and achievements from their resume in response to the job requirements outlined in the JD."
Here is the resume content : {text}
Here is the job description : {jd}
Instructions for Response:
Technical Questions:
Create questions that are directly related to the technical skills and experiences mentioned in the JD and resume.
Ensure questions cover a range of difficulties (easy, medium, hard) and are relevant to real-world scenarios the candidate might face in the role.
HR Questions:
Formulate questions that assess cultural fit, teamwork, leadership, and resilience.
Questions should invite responses that allow the candidate to demonstrate their problem-solving approach, adaptability, and growth mindset.
Suggested Answers:
Provide comprehensive sample answers for each question, guiding the candidate on how to integrate their specific experiences and achievements from the resume.
Highlight how each answer can align with the expectations set forth in the JD, showcasing the candidate's suitability for the role.
Your Response Should have the following structure
Technical Interview Questions:
Question1: (Question here)
Answer1: (Answer here)
Similarly all other questions.
HR Interview Questions:
Question1: (Question here)
Answer1: (Answer here)
Similarly all other questions.
"""
response = get_gemini_response(prompt5)
st.subheader("Interview Preperation Guide ")
st.write("Here are some sample Technical and HR interview questions which will help you in answering different questions faced in the interviews.")
st.write(response)
else:
st.error("No job description provided.")
else:
st.error("No job description provided.")
st.error("Resume Not Uploaded.")
else:
st.error("No Job Role Specified")
st.error("No job description provided.")
st.error("Resume Not Uploaded.")