DreamStream-1 commited on
Commit
ff32b52
·
verified ·
1 Parent(s): e0430a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -46
app.py CHANGED
@@ -129,7 +129,7 @@ def communication_generator(resume_skills, job_description_skills, skills_simila
129
  return message
130
 
131
  # --- Sentiment Analysis --- #
132
- def sentiment_analysis(text):
133
  """Analyzes the sentiment of the text."""
134
  model_name = "mrm8488/distiluse-base-multilingual-cased-v2-finetuned-stsb_multi_mt-es"
135
  tokenizer = AutoTokenizer.from_pretrained(model_name)
@@ -173,53 +173,37 @@ def analyze_resume(resume_file, job_description_file):
173
 
174
  # Generate communication based on analysis
175
  response_message = communication_generator(
176
- resume_skills,
177
- job_description_skills,
178
- skills_similarity,
179
- qualifications_similarity,
180
- experience_similarity,
181
- candidate_experience
182
  )
183
 
 
 
 
184
  return {
185
- "Resume Experience Summary": resume_experience_summary,
186
- "Job Description Experience Summary": job_description_experience_summary,
187
- "Skills Similarity": skills_similarity,
188
- "Qualifications Similarity": qualifications_similarity,
189
- "Experience Similarity": experience_similarity,
190
- "Candidate Experience": candidate_experience,
191
- "Response Message": response_message,
192
  }
193
 
194
-
195
-
196
- # --- Gradio Interface --- #
197
- def main():
198
- """Runs the Gradio application for resume analysis."""
199
- interface = gr.Interface(
200
- fn=analyze_resume,
201
- inputs=[
202
- gr.File(label="Upload Resume (PDF/TXT)", type="filepath"),
203
- gr.File(label="Upload Job Description (PDF/TXT)", type="filepath")
204
- ],
205
- outputs=[
206
- gr.Textbox(label="Skills Similarity"),
207
- gr.Textbox(label="Qualifications Similarity"),
208
- gr.Textbox(label="Experience Similarity"),
209
- gr.Textbox(label="Communication Response"),
210
- gr.Textbox(label="Sentiment Analysis"),
211
- gr.Textbox(label="Resume Skills"),
212
- gr.Textbox(label="Job Description Skills"),
213
- gr.Textbox(label="Resume Qualifications"),
214
- gr.Textbox(label="Job Description Qualifications"),
215
- gr.Textbox(label="Resume Experience"),
216
- gr.Textbox(label="Job Description Experience")
217
- ],
218
- title="Resume and Job Description Analysis",
219
- description="Analyze a resume against a job description to evaluate skills, qualifications, experience, and generate communication insights."
220
- )
221
-
222
- interface.launch()
223
-
224
- if __name__ == "__main__":
225
- main()
 
129
  return message
130
 
131
  # --- Sentiment Analysis --- #
132
+ def analyze_sentiment(text):
133
  """Analyzes the sentiment of the text."""
134
  model_name = "mrm8488/distiluse-base-multilingual-cased-v2-finetuned-stsb_multi_mt-es"
135
  tokenizer = AutoTokenizer.from_pretrained(model_name)
 
173
 
174
  # Generate communication based on analysis
175
  response_message = communication_generator(
176
+ resume_skills, job_description_skills,
177
+ skills_similarity, qualifications_similarity,
178
+ experience_similarity, candidate_experience
 
 
 
179
  )
180
 
181
+ # Perform sentiment analysis on the resume
182
+ sentiment_analysis_result = analyze_sentiment(resume_text)
183
+
184
  return {
185
+ "skills_similarity": skills_similarity,
186
+ "qualifications_similarity": qualifications_similarity,
187
+ "experience_similarity": experience_similarity,
188
+ "resume_experience_summary": resume_experience_summary,
189
+ "job_description_experience_summary": job_description_experience_summary,
190
+ "response_message": response_message,
191
+ "sentiment": sentiment_analysis_result,
192
  }
193
 
194
+ # --- Gradio Interface Setup --- #
195
+ def upload_and_analyze(resume_file, job_description_file):
196
+ """Handles file upload and calls the analysis function."""
197
+ return analyze_resume(resume_file, job_description_file)
198
+
199
+ # Create a Gradio interface for the application
200
+ interface = gr.Interface(
201
+ fn=upload_and_analyze,
202
+ inputs=["file", "file"],
203
+ outputs=["json"],
204
+ title="Resume and Job Description Analyzer",
205
+ description="Upload a resume and a job description to analyze the fit.",
206
+ )
207
+
208
+ # Run the Gradio interface
209
+ interface.launch()