DreamStream-1 commited on
Commit
ff0fcfe
·
verified ·
1 Parent(s): af3fe4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -13
app.py CHANGED
@@ -100,7 +100,7 @@ def display_resume(file, index):
100
  st.error(f"Unsupported file type for {file.name}. Please upload a PDF or DOCX file.")
101
 
102
  def analyze_multiple_resumes(resumes, job_description):
103
- """Analyze multiple resumes and take the average of the match percentage from 3 analyses."""
104
  match_percentages = []
105
 
106
  for index, resume in enumerate(resumes):
@@ -113,21 +113,17 @@ def analyze_multiple_resumes(resumes, job_description):
113
  elif file_type == 'docx':
114
  text = extract_text_from_docx(resume)
115
 
116
- # Analyze the resume 3 times and calculate the average match percentage
117
- analysis_results = []
118
- for _ in range(3): # Run the analysis 3 times
119
- analysis = analyze_documents(text, job_description)
120
- match_percentage = extract_match_percentage(analysis)
121
- analysis_results.append(match_percentage)
122
 
123
- # Calculate the average match percentage
124
- avg_match_percentage = sum(analysis_results) / len(analysis_results)
125
- match_percentages.append(avg_match_percentage)
126
 
127
  # Display the result
128
- st.write(f"### Average Match Percentage for {resume.name}: {avg_match_percentage:.2f}%")
129
- st.progress(avg_match_percentage / 100) # Convert to decimal format
130
-
131
  # Overall match percentage across all resumes
132
  if match_percentages:
133
  avg_overall_match = sum(match_percentages) / len(match_percentages)
 
100
  st.error(f"Unsupported file type for {file.name}. Please upload a PDF or DOCX file.")
101
 
102
  def analyze_multiple_resumes(resumes, job_description):
103
+ """Analyze multiple resumes."""
104
  match_percentages = []
105
 
106
  for index, resume in enumerate(resumes):
 
113
  elif file_type == 'docx':
114
  text = extract_text_from_docx(resume)
115
 
116
+ # Analyze the resume once
117
+ analysis = analyze_documents(text, job_description)
118
+ match_percentage = extract_match_percentage(analysis)
 
 
 
119
 
120
+ # Store the result
121
+ match_percentages.append(match_percentage)
 
122
 
123
  # Display the result
124
+ st.write(f"### Match Percentage for {resume.name}: {match_percentage}%")
125
+ st.progress(match_percentage / 100) # Convert to decimal format
126
+
127
  # Overall match percentage across all resumes
128
  if match_percentages:
129
  avg_overall_match = sum(match_percentages) / len(match_percentages)