Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,40 @@ import pdfplumber
|
|
| 4 |
import re
|
| 5 |
from collections import Counter
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# Function to extract text from PDF
|
| 8 |
def extract_text_from_pdf(pdf_file):
|
| 9 |
with pdfplumber.open(pdf_file) as pdf:
|
|
@@ -83,15 +117,19 @@ def calculate_job_fit_score(resume_text, job_description):
|
|
| 83 |
|
| 84 |
# Main App
|
| 85 |
def main():
|
| 86 |
-
|
|
|
|
|
|
|
| 87 |
st.write(
|
| 88 |
"Upload your resume to check its ATS-friendliness and compare it with a job description for keyword matching."
|
| 89 |
)
|
| 90 |
|
|
|
|
|
|
|
| 91 |
uploaded_resume = st.file_uploader(
|
| 92 |
-
"Upload your Resume (PDF or Word):", type=["pdf", "docx"]
|
| 93 |
)
|
| 94 |
-
job_description = st.text_area("Paste the Job Description:")
|
| 95 |
|
| 96 |
if uploaded_resume:
|
| 97 |
# Extract text based on file type
|
|
@@ -104,46 +142,41 @@ def main():
|
|
| 104 |
return
|
| 105 |
|
| 106 |
# Analyze ATS-friendliness
|
| 107 |
-
st.
|
| 108 |
ats_score, ats_suggestions = check_ats_friendly(resume_text)
|
| 109 |
st.metric("ATS Score", f"{ats_score}/100")
|
| 110 |
if ats_score >= 80:
|
| 111 |
-
st.success("Your resume is ATS-friendly!")
|
| 112 |
else:
|
| 113 |
-
st.warning("Your resume needs improvement to be ATS-friendly.")
|
| 114 |
|
| 115 |
# Display ATS suggestions
|
| 116 |
-
st.
|
| 117 |
if ats_suggestions:
|
| 118 |
for idx, suggestion in enumerate(ats_suggestions, 1):
|
| 119 |
-
st.
|
| 120 |
else:
|
| 121 |
-
st.write("
|
|
|
|
|
|
|
| 122 |
|
| 123 |
# Analyze Job Fit
|
| 124 |
if job_description.strip():
|
| 125 |
-
st.
|
| 126 |
job_fit_score, job_fit_suggestions, missing_keywords = calculate_job_fit_score(
|
| 127 |
resume_text, job_description
|
| 128 |
)
|
| 129 |
st.metric("Job Fit Score", f"{job_fit_score:.2f}%")
|
| 130 |
if job_fit_score >= 70:
|
| 131 |
-
st.success("Your resume matches well with the job description!")
|
| 132 |
else:
|
| 133 |
-
st.warning("Your resume could be tailored better to match the job description.")
|
| 134 |
|
| 135 |
# Display job fit suggestions
|
| 136 |
-
st.
|
| 137 |
-
if job_fit_suggestions:
|
| 138 |
-
for idx, suggestion in enumerate(job_fit_suggestions, 1):
|
| 139 |
-
st.write(f"{idx}. {suggestion}")
|
| 140 |
-
else:
|
| 141 |
-
st.write("No specific suggestions. Great match!")
|
| 142 |
-
|
| 143 |
-
# Recommend missing keywords
|
| 144 |
if missing_keywords:
|
| 145 |
-
st.
|
| 146 |
-
st.
|
| 147 |
else:
|
| 148 |
st.write("Your resume already includes all the required keywords!")
|
| 149 |
|
|
|
|
| 4 |
import re
|
| 5 |
from collections import Counter
|
| 6 |
|
| 7 |
+
# Custom CSS for UI enhancements
|
| 8 |
+
def apply_custom_css():
|
| 9 |
+
st.markdown("""
|
| 10 |
+
<style>
|
| 11 |
+
.title {
|
| 12 |
+
font-size: 2.5rem;
|
| 13 |
+
color: #4CAF50;
|
| 14 |
+
text-align: center;
|
| 15 |
+
margin-bottom: 20px;
|
| 16 |
+
}
|
| 17 |
+
.subtitle {
|
| 18 |
+
font-size: 1.5rem;
|
| 19 |
+
color: #FF5722;
|
| 20 |
+
margin-top: 20px;
|
| 21 |
+
margin-bottom: 10px;
|
| 22 |
+
}
|
| 23 |
+
.metric {
|
| 24 |
+
font-size: 1.2rem;
|
| 25 |
+
text-align: center;
|
| 26 |
+
}
|
| 27 |
+
.separator {
|
| 28 |
+
border-top: 2px solid #eee;
|
| 29 |
+
margin-top: 30px;
|
| 30 |
+
margin-bottom: 30px;
|
| 31 |
+
}
|
| 32 |
+
.suggestions {
|
| 33 |
+
background-color: #f9f9f9;
|
| 34 |
+
border-left: 4px solid #2196F3;
|
| 35 |
+
padding: 10px;
|
| 36 |
+
margin: 10px 0;
|
| 37 |
+
}
|
| 38 |
+
</style>
|
| 39 |
+
""", unsafe_allow_html=True)
|
| 40 |
+
|
| 41 |
# Function to extract text from PDF
|
| 42 |
def extract_text_from_pdf(pdf_file):
|
| 43 |
with pdfplumber.open(pdf_file) as pdf:
|
|
|
|
| 117 |
|
| 118 |
# Main App
|
| 119 |
def main():
|
| 120 |
+
apply_custom_css()
|
| 121 |
+
|
| 122 |
+
st.markdown("<div class='title'>ATS Resume Checker</div>", unsafe_allow_html=True)
|
| 123 |
st.write(
|
| 124 |
"Upload your resume to check its ATS-friendliness and compare it with a job description for keyword matching."
|
| 125 |
)
|
| 126 |
|
| 127 |
+
st.markdown("<hr class='separator'>", unsafe_allow_html=True)
|
| 128 |
+
|
| 129 |
uploaded_resume = st.file_uploader(
|
| 130 |
+
"π Upload your Resume (PDF or Word):", type=["pdf", "docx"]
|
| 131 |
)
|
| 132 |
+
job_description = st.text_area("π Paste the Job Description:")
|
| 133 |
|
| 134 |
if uploaded_resume:
|
| 135 |
# Extract text based on file type
|
|
|
|
| 142 |
return
|
| 143 |
|
| 144 |
# Analyze ATS-friendliness
|
| 145 |
+
st.markdown("<div class='subtitle'>π οΈ ATS Analysis</div>", unsafe_allow_html=True)
|
| 146 |
ats_score, ats_suggestions = check_ats_friendly(resume_text)
|
| 147 |
st.metric("ATS Score", f"{ats_score}/100")
|
| 148 |
if ats_score >= 80:
|
| 149 |
+
st.success("β
Your resume is ATS-friendly!")
|
| 150 |
else:
|
| 151 |
+
st.warning("β οΈ Your resume needs improvement to be ATS-friendly.")
|
| 152 |
|
| 153 |
# Display ATS suggestions
|
| 154 |
+
st.markdown("<div class='subtitle'>π Suggestions for ATS Improvement</div>", unsafe_allow_html=True)
|
| 155 |
if ats_suggestions:
|
| 156 |
for idx, suggestion in enumerate(ats_suggestions, 1):
|
| 157 |
+
st.markdown(f"<div class='suggestions'>{idx}. {suggestion}</div>", unsafe_allow_html=True)
|
| 158 |
else:
|
| 159 |
+
st.write("Your resume is well-optimized for ATS!")
|
| 160 |
+
|
| 161 |
+
st.markdown("<hr class='separator'>", unsafe_allow_html=True)
|
| 162 |
|
| 163 |
# Analyze Job Fit
|
| 164 |
if job_description.strip():
|
| 165 |
+
st.markdown("<div class='subtitle'>π Job Description Matching</div>", unsafe_allow_html=True)
|
| 166 |
job_fit_score, job_fit_suggestions, missing_keywords = calculate_job_fit_score(
|
| 167 |
resume_text, job_description
|
| 168 |
)
|
| 169 |
st.metric("Job Fit Score", f"{job_fit_score:.2f}%")
|
| 170 |
if job_fit_score >= 70:
|
| 171 |
+
st.success("β
Your resume matches well with the job description!")
|
| 172 |
else:
|
| 173 |
+
st.warning("β οΈ Your resume could be tailored better to match the job description.")
|
| 174 |
|
| 175 |
# Display job fit suggestions
|
| 176 |
+
st.markdown("<div class='subtitle'>π Missing Keywords</div>", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
if missing_keywords:
|
| 178 |
+
st.write("To improve matching, consider including these keywords:")
|
| 179 |
+
st.markdown(f"<div class='suggestions'>{', '.join(missing_keywords)}</div>", unsafe_allow_html=True)
|
| 180 |
else:
|
| 181 |
st.write("Your resume already includes all the required keywords!")
|
| 182 |
|