-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
329 lines (212 loc) · 8.25 KB
/
Copy pathapp.py
File metadata and controls
329 lines (212 loc) · 8.25 KB
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
# ==========================
# Import Required Libraries
# ==========================
import matplotlib.pyplot as plt
import streamlit as st
from utils.pdf_reader import extract_text
from utils.skill_extractor import extract_skills
from utils.ats_score import calculate_ats_score
from ai.ai_feedback import generate_ai_feedback
# ==========================
# Page Configuration
# ==========================
st.set_page_config(
page_title="AI Resume Analyzer",
page_icon="📄",
layout="wide"
)
# ==========================
# Sidebar
# ==========================
st.sidebar.title("📄 AI Resume Analyzer")
st.sidebar.markdown("""
### Instructions
1. Upload Resume (PDF)
2. Paste Job Description
3. View ATS Score
4. Analyze Missing Skills
---
""")
st.sidebar.success("🚀 Version 2.0 (Gemini AI Powered)")
# ==========================
# Title
# ==========================
st.title("📄 AI Resume Analyzer")
st.markdown("""
Welcome to the **AI Resume Analyzer**!
This application helps job seekers improve their resumes by:
- 📄 Extracting text from uploaded PDF resumes
- 🧠 Detecting technical skills using NLP
- 🎯 Comparing resumes with Job Descriptions
- 📊 Calculating an ATS-style Resume Match Score
- 🤖 Generating personalized AI feedback using Gemini
- 📥 Downloading a detailed ATS report
Upload your resume to get started.
""")
# ==========================
# Resume Upload
# ==========================
uploaded_file = st.file_uploader(
"📄 Upload Your Resume (PDF)",
type=["pdf"]
)
# ==========================
# Process Resume
# ==========================
if uploaded_file:
st.success("✅ Resume Uploaded Successfully!")
# Extract Resume Text
resume_text = extract_text(uploaded_file)
# Extract Resume Skills
resume_skills = list(dict.fromkeys(extract_skills(resume_text)))
left, right = st.columns([1.3, 1])
with left:
st.subheader("📄 Extracted Resume")
st.text_area(
"Resume Content",
resume_text,
height=420
)
st.subheader("🛠 Resume Skills")
if resume_skills:
st.markdown(
" ".join(
[f"`{skill}`" for skill in resume_skills]
))
else:
st.warning("No matching skills found.")
# ==========================
# Job Description
# ==========================
with right:
st.subheader("📋 Job Description")
jd = st.text_area(
"Paste the Job Description Here",
height=220
)
if jd:
jd_skills = extract_skills(jd)
score, matched_skills, missing_skills = calculate_ats_score(
resume_skills,
jd_skills
)
st.subheader("📊 Resume Statistics")
col1, col2, col3, col4 = st.columns(4)
col1.metric("ATS Score", f"{score}%")
col2.metric("Resume Skills", len(resume_skills))
col3.metric("Matched", len(matched_skills))
col4.metric("Missing", len(missing_skills))
st.subheader("📈 ATS Resume Match Score")
st.progress(score / 100)
st.metric(
label="Resume Match",
value=f"{score}%"
)
# ---------- ADDED FROM HERE ----------
if score >= 90:
st.success("🟢 Excellent! Your resume is highly ATS-friendly.")
elif score >= 75:
st.info("🔵 Good! Your resume matches most job requirements.")
elif score >= 60:
st.warning("🟡 Average. Add more relevant skills to improve your ATS score.")
else:
st.error("🔴 Needs Improvement. Consider adding the missing skills listed below.")
# ---------- STOPPED HERE ----------
st.subheader("✅ Matched Skills")
if matched_skills:
st.success(", ".join(matched_skills))
else:
st.warning("No matched skills found.")
st.subheader("❌ Missing Skills")
if missing_skills:
st.error(", ".join(missing_skills))
else:
st.success("🎉 Great! Your resume matches all required skills.")
st.subheader("💡 Resume Improvement Suggestions")
if missing_skills:
for skill in missing_skills:
st.write(
f"✅ Add **{skill}** to your resume if you have experience with it."
)
else:
st.success("🎉 Your resume already matches the job requirements.")
# //AI FEEDBACK
st.subheader("🤖 Gemini AI Career Coach")
feedback = ""
with st.spinner("🤖 Gemini AI is analyzing your resume..."):
try:
feedback = generate_ai_feedback(
score,
matched_skills,
missing_skills
)
st.markdown(feedback)
except Exception as e:
st.warning(
"⚠ Gemini AI is currently busy. Please try again in a few moments."
)
st.subheader("📊 Resume Skill Match Distribution")
fig, ax = plt.subplots(figsize=(5,5))
ax.set_title("Skill Match Distribution")
ax.pie(
[len(matched_skills), len(missing_skills)],
labels=["Matched", "Missing"],
colors=["#2ECC71", "#E74C3C"],
autopct="%1.1f%%",
startangle=90
)
ax.axis("equal")
st.pyplot(fig)
plt.close(fig)
st.divider()
st.subheader("📥 Download Analysis")
report = f"""
==============================
AI Resume Analyzer Report
==============================
ATS Score : {score}%
Resume Skills:
{', '.join(resume_skills)}
Matched Skills:
{', '.join(matched_skills)}
Missing Skills:
{', '.join(missing_skills)}
"""
report += "\n\nResume Improvement Suggestions:\n"
report += "\n\nAI Feedback:\n"
report += feedback
if missing_skills:
for skill in missing_skills:
report += f"• Consider adding {skill} if you have practical experience with it.\n"
else:
report += "Excellent! Your resume already matches the job description.\n"
st.download_button(
label="📥 Download ATS Report",
data=report,
file_name="ATS_Report.txt",
mime="text/plain"
)
#order of my app-
# Upload Resume
# ↓
# Extract Resume Text
# ↓
# Resume Skills
# ↓
# Paste Job Description
# ↓
# Resume Statistics
# ↓
# ATS Progress Bar
# ↓
# ATS Feedback
# ↓
# Matched Skills
# ↓
# Missing Skills
# ↓
# Resume Suggestions
# ↓
# Pie Chart
# ↓
# Download Report