Alexvatti commited on
Commit
782310c
·
verified ·
1 Parent(s): dcab2e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -83
app.py CHANGED
@@ -55,80 +55,17 @@ match_agent = Agent(
55
  llm=llm
56
  )
57
 
58
- # Streamlit UI
59
  st.title("🔍 AI-Powered ATS Scanner")
60
 
61
- # Sidebar navigation
62
- menu = st.sidebar.radio("Select Process", ["1️⃣ Extract Resume Keywords", "2️⃣ Analyze JD", "3️⃣ ATS Match Score"])
 
63
 
64
- if menu == "1️⃣ Extract Resume Keywords":
65
- st.subheader("📄 Resume Keyword Extractor")
66
- resume_file = st.file_uploader("Upload Resume (PDF/DOC)", type=["pdf", "docx"])
67
- if st.button("Extract Keywords"):
68
- if resume_file:
69
- resume_text = extract_text_from_file(resume_file)
70
-
71
- task_resume = Task(
72
- description=f"""Given the following resume text:\n\n{resume_text}\n\n
73
- Extract ONLY technical skills, programming languages, tools, domain-specific keywords, and certifications.
74
- DO NOT include soft skills, personality traits, or general qualities.
75
- Provide the output as a clean comma-separated list of keywords.""",
76
- agent=resume_agent,
77
- expected_output="List of keywords, technical skills, tools, programming languages, and certifications mentioned in the resume."
78
- )
79
-
80
- crew = Crew(
81
- agents=[resume_agent],
82
- tasks=[task_resume],
83
- verbose=True
84
- )
85
 
86
- result = crew.kickoff(inputs={"resume_text": resume_text})
87
- extracted_keywords = result.tasks_output[0].raw
88
- st.write("### ✅ Extracted Resume Keywords and Skills:")
89
- skills = extracted_keywords.split("\n")
90
- for skill in skills:
91
- if skill.strip():
92
- st.write(f"- {skill.strip()}")
93
- else:
94
- st.warning("Please upload a resume file.")
95
-
96
- elif menu == "2️⃣ Analyze JD":
97
- st.subheader("📝 Job Description Analyzer")
98
- job_description = st.text_area("Paste Job Description")
99
- if st.button("Analyze JD"):
100
- if job_description:
101
- task_jd = Task(
102
- description=f"""Given the following Job Description:\n\n{job_description}\n\n
103
- Extract ONLY technical skills, programming languages, tools, domain-specific keywords, and certifications mentioned.
104
- DO NOT include soft skills like 'communication skills', 'time management', or general traits.
105
- Provide the output as a clean, comma-separated list of technical and domain-specific skills.""",
106
- agent=jd_agent,
107
- expected_output="List of keywords, technical skills, tools, programming languages and domain-specific skills"
108
- )
109
-
110
- crew = Crew(
111
- agents=[jd_agent],
112
- tasks=[task_jd],
113
- verbose=True
114
- )
115
-
116
- result = crew.kickoff(inputs={"job_description": job_description})
117
- extracted_keywords = result.tasks_output[0].raw
118
- st.write("### ✅ Extracted JD Keywords:")
119
- skills = extracted_keywords.split("\n")
120
- for skill in skills:
121
- if skill.strip():
122
- st.write(f"- {skill.strip()}")
123
- else:
124
- st.warning("Please paste a job description.")
125
-
126
- elif menu == "3️⃣ ATS Match Score":
127
- st.subheader("⚙️ Resume & JD Match Analysis")
128
- resume_file = st.file_uploader("Upload Resume (PDF/DOC)", type=["pdf", "docx"], key="match_resume")
129
- job_description = st.text_area("Paste Job Description", key="match_jd")
130
- if st.button("Analyze Match"):
131
- if resume_file and job_description:
132
  resume_text = extract_text_from_file(resume_file)
133
 
134
  task_match = Task(
@@ -149,20 +86,32 @@ elif menu == "3️⃣ ATS Match Score":
149
  crew = Crew(
150
  agents=[match_agent],
151
  tasks=[task_match],
152
- verbose=True
153
  )
154
 
155
  result = crew.kickoff(inputs={"resume_text": resume_text, "job_description": job_description})
156
  extracted_keywords = result.tasks_output[0].raw
157
-
158
- # Then parse extracted_keywords
159
- match_score_line = next((line for line in extracted_keywords.split('\n') if "Match Score" in line), None)
160
- missing_keywords_line = next((line for line in extracted_keywords.split('\n') if "Missing Keywords" in line), None)
161
- st.success("✅ ATS Match Result:")
162
- st.markdown(f"**{match_score_line.strip()}**")
163
- st.markdown(f"**{missing_keywords_line.strip()}**")
164
-
165
- else:
166
- st.warning("Please upload resume and paste job description.")
167
- else:
168
- st.warning("Invalid Input")
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  llm=llm
56
  )
57
 
 
58
  st.title("🔍 AI-Powered ATS Scanner")
59
 
60
+ st.subheader("⚙️ Resume & JD Match Analysis")
61
+ resume_files = st.file_uploader("Upload Resumes (PDF/DOC)", type=["pdf", "docx"], accept_multiple_files=True, key="match_resume")
62
+ job_description = st.text_area("Paste Job Description", key="match_jd")
63
 
64
+ if st.button("Analyze Match"):
65
+ if resume_files and job_description:
66
+ results = []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
+ for resume_file in resume_files:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  resume_text = extract_text_from_file(resume_file)
70
 
71
  task_match = Task(
 
86
  crew = Crew(
87
  agents=[match_agent],
88
  tasks=[task_match],
89
+ verbose=False
90
  )
91
 
92
  result = crew.kickoff(inputs={"resume_text": resume_text, "job_description": job_description})
93
  extracted_keywords = result.tasks_output[0].raw
94
+
95
+ # Parse result
96
+ match_score_line = next((line for line in extracted_keywords.split('\n') if "Match Score" in line), "")
97
+ missing_keywords_line = next((line for line in extracted_keywords.split('\n') if "Missing Keywords" in line), "")
98
+
99
+ try:
100
+ score = int(match_score_line.split(":")[1].strip().replace("%", ""))
101
+ except:
102
+ score = 0
103
+
104
+ results.append({
105
+ "Resume": resume_file.name,
106
+ "Match Score (%)": score,
107
+ "Missing Keywords": missing_keywords_line.split(":", 1)[-1].strip()
108
+ })
109
+
110
+ # Sort by Match Score descending
111
+ results_sorted = sorted(results, key=lambda x: x["Match Score (%)"], reverse=True)
112
+
113
+ st.success("✅ ATS Match Results Table")
114
+ st.dataframe(results_sorted)
115
+
116
+ else:
117
+ st.warning("Please upload at least one resume and paste the job description.")