Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
62 |
-
|
|
|
63 |
|
64 |
-
if
|
65 |
-
|
66 |
-
|
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 |
-
|
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=
|
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 |
-
#
|
159 |
-
match_score_line = next((line for line in extracted_keywords.split('\n') if "Match Score" in line),
|
160 |
-
missing_keywords_line = next((line for line in extracted_keywords.split('\n') if "Missing Keywords" in line),
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.")
|