Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,13 +15,12 @@ if "resume_data" not in st.session_state:
|
|
15 |
if "jobdescription" not in st.session_state:
|
16 |
st.session_state.jobdescription = ""
|
17 |
|
18 |
-
#
|
19 |
st.session_state.jobdescription = st.text_area("Paste the job description below:")
|
20 |
|
21 |
-
#
|
22 |
pdf_files = st.file_uploader("Upload your resumes (PDF only):", type="pdf", accept_multiple_files=True)
|
23 |
|
24 |
-
# Handle PDF file upload
|
25 |
if pdf_files:
|
26 |
st.session_state.resume_data = []
|
27 |
for pdf in pdf_files:
|
@@ -32,6 +31,7 @@ if pdf_files:
|
|
32 |
# Submit button
|
33 |
submit = st.button("Submit")
|
34 |
|
|
|
35 |
# Define start function
|
36 |
def start():
|
37 |
if st.session_state.resume_data and st.session_state.jobdescription:
|
@@ -44,30 +44,30 @@ def start():
|
|
44 |
ATS_score = calculateATSscore(resume["text"], st.session_state.jobdescription)
|
45 |
|
46 |
if ATS_score is None:
|
47 |
-
st.warning(f"Warning: Unable to calculate ATS score for {resume['name']}.
|
48 |
continue # Skip this resume if ATS score is None
|
49 |
|
50 |
resume["ATS_score"] = ATS_score # Add ATS score to resume data
|
51 |
-
|
52 |
-
# Generate feedback
|
53 |
-
resume["model_feedback"] = modelFeedback(resume["text"]) #
|
54 |
-
|
55 |
time.sleep(1) # Optional: Simulate processing time
|
56 |
|
57 |
-
# Sort resumes based on ATS score in descending order
|
58 |
-
sorted_resumes = sorted(
|
59 |
-
key=lambda x: x["ATS_score"], reverse=True)
|
60 |
|
61 |
# Display the results
|
62 |
for rank, resume in enumerate(sorted_resumes, 1):
|
63 |
st.write(f"##### Resume: {resume['name']}")
|
64 |
-
st.write(f"**ATS Score:** {int(resume['ATS_score']
|
65 |
st.write(f"**Ranking:** {rank}")
|
66 |
-
st.write(f"**Summary:** {resume['model_feedback']}")
|
67 |
st.write("---")
|
68 |
else:
|
69 |
st.info("Please upload resumes and provide a job description.")
|
70 |
|
|
|
71 |
# Process when submit button is clicked
|
72 |
if submit:
|
73 |
start()
|
|
|
15 |
if "jobdescription" not in st.session_state:
|
16 |
st.session_state.jobdescription = ""
|
17 |
|
18 |
+
# Upload Resumes (Multiple PDFs)
|
19 |
st.session_state.jobdescription = st.text_area("Paste the job description below:")
|
20 |
|
21 |
+
# Input Job Description
|
22 |
pdf_files = st.file_uploader("Upload your resumes (PDF only):", type="pdf", accept_multiple_files=True)
|
23 |
|
|
|
24 |
if pdf_files:
|
25 |
st.session_state.resume_data = []
|
26 |
for pdf in pdf_files:
|
|
|
31 |
# Submit button
|
32 |
submit = st.button("Submit")
|
33 |
|
34 |
+
|
35 |
# Define start function
|
36 |
def start():
|
37 |
if st.session_state.resume_data and st.session_state.jobdescription:
|
|
|
44 |
ATS_score = calculateATSscore(resume["text"], st.session_state.jobdescription)
|
45 |
|
46 |
if ATS_score is None:
|
47 |
+
st.warning(f"Warning: Unable to calculate ATS score for {resume['name']}.")
|
48 |
continue # Skip this resume if ATS score is None
|
49 |
|
50 |
resume["ATS_score"] = ATS_score # Add ATS score to resume data
|
51 |
+
|
52 |
+
# Generate feedback from model
|
53 |
+
resume["model_feedback"] = modelFeedback(resume["text"]) # Store model feedback in the resume data
|
54 |
+
|
55 |
time.sleep(1) # Optional: Simulate processing time
|
56 |
|
57 |
+
# Sort resumes based on ATS score in descending order
|
58 |
+
sorted_resumes = sorted(st.session_state.resume_data, key=lambda x: x["ATS_score"], reverse=True)
|
|
|
59 |
|
60 |
# Display the results
|
61 |
for rank, resume in enumerate(sorted_resumes, 1):
|
62 |
st.write(f"##### Resume: {resume['name']}")
|
63 |
+
st.write(f"**ATS Score:** {int(resume['ATS_score']*100)}%")
|
64 |
st.write(f"**Ranking:** {rank}")
|
65 |
+
st.write(f"**Summary:** {resume['model_feedback']}") # Display the individual feedback for each resume
|
66 |
st.write("---")
|
67 |
else:
|
68 |
st.info("Please upload resumes and provide a job description.")
|
69 |
|
70 |
+
|
71 |
# Process when submit button is clicked
|
72 |
if submit:
|
73 |
start()
|