Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,7 @@ import re
|
|
| 7 |
import google.generativeai as genai
|
| 8 |
from sklearn.feature_extraction.text import TfidfVectorizer
|
| 9 |
from sklearn.metrics.pairwise import cosine_similarity
|
|
|
|
| 10 |
import json
|
| 11 |
|
| 12 |
# Load pre-trained embedding model for basic analysis
|
|
@@ -80,11 +81,11 @@ def analyze_with_gemini(resume_text, job_desc):
|
|
| 80 |
# Handle parsing errors
|
| 81 |
return {
|
| 82 |
"Candidate Name": "Unknown",
|
| 83 |
-
"Relevant Skills": "Failed
|
| 84 |
-
"Educational Background": "Failed
|
| 85 |
-
"Leadership Experience (years)": "Failed
|
| 86 |
-
"Management Experience (years)": "Failed
|
| 87 |
-
"Management Skills": "Failed
|
| 88 |
"Summary": response.text.strip()
|
| 89 |
}
|
| 90 |
|
|
@@ -161,25 +162,20 @@ def process_resumes(job_desc_file, resumes):
|
|
| 161 |
"Gemini Analysis": gemini_analysis["Summary"]
|
| 162 |
})
|
| 163 |
|
| 164 |
-
#
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
f"Management Skills (combined): {res['Management Skills']}\n"
|
| 173 |
-
f"Gemini Analysis:\n{res['Gemini Analysis']}\n"
|
| 174 |
-
for res in results
|
| 175 |
-
)
|
| 176 |
-
return output
|
| 177 |
|
| 178 |
# Gradio Interface
|
| 179 |
job_desc_input = gr.File(label="Upload Job Description (TXT, PDF, DOCX)", type="filepath")
|
| 180 |
resumes_input = gr.Files(label="Upload Resumes (TXT, PDF, DOCX)", type="filepath")
|
| 181 |
|
| 182 |
-
results_output = gr.
|
| 183 |
|
| 184 |
interface = gr.Interface(
|
| 185 |
fn=process_resumes,
|
|
|
|
| 7 |
import google.generativeai as genai
|
| 8 |
from sklearn.feature_extraction.text import TfidfVectorizer
|
| 9 |
from sklearn.metrics.pairwise import cosine_similarity
|
| 10 |
+
import pandas as pd
|
| 11 |
import json
|
| 12 |
|
| 13 |
# Load pre-trained embedding model for basic analysis
|
|
|
|
| 81 |
# Handle parsing errors
|
| 82 |
return {
|
| 83 |
"Candidate Name": "Unknown",
|
| 84 |
+
"Relevant Skills": "Failed",
|
| 85 |
+
"Educational Background": "Failed",
|
| 86 |
+
"Leadership Experience (years)": "Failed",
|
| 87 |
+
"Management Experience (years)": "Failed",
|
| 88 |
+
"Management Skills": "Failed",
|
| 89 |
"Summary": response.text.strip()
|
| 90 |
}
|
| 91 |
|
|
|
|
| 162 |
"Gemini Analysis": gemini_analysis["Summary"]
|
| 163 |
})
|
| 164 |
|
| 165 |
+
# Convert results to pandas DataFrame
|
| 166 |
+
df = pd.DataFrame(results)
|
| 167 |
+
|
| 168 |
+
# Save DataFrame to CSV
|
| 169 |
+
csv_file = "/tmp/analysis_results.csv"
|
| 170 |
+
df.to_csv(csv_file, index=False)
|
| 171 |
+
|
| 172 |
+
return csv_file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
|
| 174 |
# Gradio Interface
|
| 175 |
job_desc_input = gr.File(label="Upload Job Description (TXT, PDF, DOCX)", type="filepath")
|
| 176 |
resumes_input = gr.Files(label="Upload Resumes (TXT, PDF, DOCX)", type="filepath")
|
| 177 |
|
| 178 |
+
results_output = gr.File(label="Download Analysis Results (CSV)")
|
| 179 |
|
| 180 |
interface = gr.Interface(
|
| 181 |
fn=process_resumes,
|