Files changed (1) hide show
  1. app.py +56 -60
app.py CHANGED
@@ -1,73 +1,69 @@
1
- # Import necessary libraries
 
 
2
  from convert import ExtractPDFText
3
- from ATS_score import calculateATSscore
4
  from model import modelFeedback
5
- import streamlit as st
6
  import time
7
 
8
  # Streamlit app title
9
  st.title("Resume Screening Assistance")
10
 
11
- # Initialize session state variables
12
- if "resume_data" not in st.session_state:
13
- st.session_state.resume_data = []
14
-
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:
27
- extracted_text = ExtractPDFText(pdf)
28
- st.session_state.resume_data.append({"name": pdf.name, "text": extracted_text})
29
- st.success(f"{len(pdf_files)} resumes uploaded and processed successfully!")
30
 
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:
38
- st.subheader("Top Matches:")
 
 
 
 
 
 
 
 
 
 
39
 
40
- # Calculate ATS scores and store them in the resumes
41
- for resume in st.session_state.resume_data:
42
- with st.spinner(f"Analyzing {resume['name']}..."):
43
- # Calculate ATS score
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(ATS_score, 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()
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import matplotlib.pyplot as plt
4
  from convert import ExtractPDFText
5
+ from ATS_score import calculateATSscore, skill_gap_analysis
6
  from model import modelFeedback
 
7
  import time
8
 
9
  # Streamlit app title
10
  st.title("Resume Screening Assistance")
11
 
12
+ # Define required skills for the job
13
+ required_skills = ["Python", "Machine Learning", "Cloud (AWS/Azure)", "Data Analysis", "React", "Docker"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
+ # Job Description Input
16
+ job_description = st.text_area("Paste the job description below:")
17
 
18
+ # Upload Resumes
19
+ uploaded_files = st.file_uploader("Upload your resumes (PDF only):", type="pdf", accept_multiple_files=True)
20
 
21
+ if uploaded_files and job_description:
22
+ resumes_data = []
23
+ for file in uploaded_files:
24
+ text = ExtractPDFText(file)
25
+ ats_score = calculateATSscore(text, job_description)
26
+ skill_analysis = skill_gap_analysis(text, required_skills)
27
+ feedback = modelFeedback(ats_score, text, skill_analysis['missing'])
28
+ resumes_data.append({
29
+ "name": file.name,
30
+ "ATS Score": ats_score,
31
+ "Skills Present": skill_analysis['present'],
32
+ "Missing Skills": skill_analysis['missing'],
33
+ "Feedback": feedback
34
+ })
35
 
36
+ # Sort resumes by ATS score
37
+ sorted_resumes = sorted(resumes_data, key=lambda x: x["ATS Score"], reverse=True)
38
+
39
+ # Display results
40
+ st.subheader("Top Matches:")
41
+ for idx, resume in enumerate(sorted_resumes, 1):
42
+ st.write(f"### {idx}. {resume['name']}")
43
+ st.write(f"**ATS Score:** {resume['ATS Score']*100:.0f}%")
44
+ st.write("**Missing Skills:**", ", ".join(resume["Missing Skills"]) if resume["Missing Skills"] else "None")
45
+ st.write("**Feedback:**", resume["Feedback"])
46
+ st.write("---")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
+ # Skill Gap Analysis Table
49
+ st.subheader("Skill Gap Analysis")
50
+ for resume in sorted_resumes:
51
+ st.write(f"**{resume['name']}**")
52
+ skill_data = {
53
+ "Required Skills": required_skills,
54
+ "Present in Resume": ["βœ…" if skill in resume["Skills Present"] else "❌" for skill in required_skills],
55
+ "Missing": [skill if skill in resume["Missing Skills"] else "β€”" for skill in required_skills]
56
+ }
57
+ df = pd.DataFrame(skill_data)
58
+ st.table(df)
59
 
60
+ # Visualize ATS Scores
61
+ st.subheader("ATS Score Distribution")
62
+ names = [r["name"] for r in sorted_resumes]
63
+ scores = [r["ATS Score"]*100 for r in sorted_resumes]
64
+ plt.figure(figsize=(8, 5))
65
+ plt.bar(names, scores)
66
+ plt.title("ATS Scores by Resume")
67
+ plt.ylabel("ATS Score (%)")
68
+ plt.xticks(rotation=45)
69
+ st.pyplot(plt)