Spaces:
Sleeping
Sleeping
DreamStream-1
commited on
Commit
•
9708aa4
1
Parent(s):
d30c79b
Update app.py
Browse files
app.py
CHANGED
@@ -120,6 +120,9 @@ def communication_generator(resume_skills, job_description_skills, skills_simila
|
|
120 |
|
121 |
# --- Updated Resume Analysis Function --- #
|
122 |
def analyze_resume(resume_file, job_description_file):
|
|
|
|
|
|
|
123 |
# Load and preprocess resume and job description
|
124 |
resume_text = extract_text_from_file(resume_file)
|
125 |
job_description_text = extract_text_from_file(job_description_file)
|
@@ -141,9 +144,6 @@ def analyze_resume(resume_file, job_description_file):
|
|
141 |
qualifications_similarity = len(set(resume_qualifications).intersection(set(job_description_qualifications))) / len(job_description_qualifications) * 100 if job_description_qualifications else 0
|
142 |
experience_similarity = 1.0 if total_experience >= required_experience else 0.0
|
143 |
|
144 |
-
# Sentiment analysis of the resume
|
145 |
-
sentiment_analysis_result = analyze_sentiment(resume_text)
|
146 |
-
|
147 |
# Fit assessment logic
|
148 |
fit_score = 0
|
149 |
if total_experience >= required_experience:
|
@@ -169,7 +169,6 @@ def analyze_resume(resume_file, job_description_file):
|
|
169 |
f"- **Experience Similarity**: {experience_similarity * 100:.2f}%\n"
|
170 |
f"- **Candidate Experience**: {total_experience} years\n"
|
171 |
f"- **Fit Assessment**: {fit_assessment}\n"
|
172 |
-
f"- **Sentiment Analysis**: {sentiment_analysis_result}\n"
|
173 |
)
|
174 |
|
175 |
skills_message = (
|
@@ -190,10 +189,8 @@ def analyze_resume(resume_file, job_description_file):
|
|
190 |
f"- **Required Experience:** {required_experience} years\n"
|
191 |
)
|
192 |
|
193 |
-
|
194 |
-
communication = communication_generator(resume_skills, job_description_skills, skills_similarity, qualifications_similarity, experience_similarity, total_experience)
|
195 |
|
196 |
-
return summary_message, skills_message, qualifications_message, experience_message, communication
|
197 |
|
198 |
def run_gradio_interface():
|
199 |
with gr.Blocks() as demo:
|
@@ -226,13 +223,11 @@ def run_gradio_interface():
|
|
226 |
|
227 |
analyze_button = gr.Button("Analyze")
|
228 |
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
return "Please upload both files."
|
234 |
|
235 |
-
analyze_button.click(analyze, inputs=[resume_file, job_description_file], outputs=[summary_output, skills_output, qualifications_output, experience_output])
|
236 |
|
237 |
demo.launch()
|
238 |
|
|
|
120 |
|
121 |
# --- Updated Resume Analysis Function --- #
|
122 |
def analyze_resume(resume_file, job_description_file):
|
123 |
+
if not resume_file or not job_description_file:
|
124 |
+
return "", "", "", "Please upload both files."
|
125 |
+
|
126 |
# Load and preprocess resume and job description
|
127 |
resume_text = extract_text_from_file(resume_file)
|
128 |
job_description_text = extract_text_from_file(job_description_file)
|
|
|
144 |
qualifications_similarity = len(set(resume_qualifications).intersection(set(job_description_qualifications))) / len(job_description_qualifications) * 100 if job_description_qualifications else 0
|
145 |
experience_similarity = 1.0 if total_experience >= required_experience else 0.0
|
146 |
|
|
|
|
|
|
|
147 |
# Fit assessment logic
|
148 |
fit_score = 0
|
149 |
if total_experience >= required_experience:
|
|
|
169 |
f"- **Experience Similarity**: {experience_similarity * 100:.2f}%\n"
|
170 |
f"- **Candidate Experience**: {total_experience} years\n"
|
171 |
f"- **Fit Assessment**: {fit_assessment}\n"
|
|
|
172 |
)
|
173 |
|
174 |
skills_message = (
|
|
|
189 |
f"- **Required Experience:** {required_experience} years\n"
|
190 |
)
|
191 |
|
192 |
+
return summary_message, skills_message, qualifications_message, experience_message
|
|
|
193 |
|
|
|
194 |
|
195 |
def run_gradio_interface():
|
196 |
with gr.Blocks() as demo:
|
|
|
223 |
|
224 |
analyze_button = gr.Button("Analyze")
|
225 |
|
226 |
+
def analyze(resume, job_desc):
|
227 |
+
# Always ensure the correct number of return values
|
228 |
+
summary, skills, qualifications, experience = analyze_resume(resume, job_desc)
|
229 |
+
return summary, skills, qualifications, experience
|
|
|
230 |
|
|
|
231 |
|
232 |
demo.launch()
|
233 |
|