Update app.py
Browse files
app.py
CHANGED
@@ -153,7 +153,16 @@ def check_similarity(job_description, resume_files):
|
|
153 |
contact_info.get('contact', 'No Contact')
|
154 |
))
|
155 |
|
156 |
-
return results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
# Gradio Interface Components
|
159 |
job_desc_input = gr.File(label="Upload Job Description (TXT)", type="filepath")
|
@@ -171,18 +180,11 @@ results_output = gr.Dataframe(headers=[
|
|
171 |
label="Analysis Results"
|
172 |
)
|
173 |
|
174 |
-
# Function to allow CSV download
|
175 |
-
def download_results(results):
|
176 |
-
df = pd.DataFrame(results, columns=["Resume File", "Similarity Score (%)", "Eligibility", "Candidate Name", "Leadership Experience", "Email", "Contact"])
|
177 |
-
csv_file = "/tmp/results.csv"
|
178 |
-
df.to_csv(csv_file, index=False)
|
179 |
-
return csv_file # Return the file path
|
180 |
-
|
181 |
# Gradio Interface
|
182 |
interface = gr.Interface(
|
183 |
fn=check_similarity,
|
184 |
inputs=[job_desc_input, resumes_input],
|
185 |
-
outputs=[results_output, gr.File(label="Download CSV"
|
186 |
title="HR Assistant - Resume Screening & Leadership Experience",
|
187 |
description="Upload job description and resumes to screen candidates for managerial and team leadership roles and extract candidate details.",
|
188 |
allow_flagging="never"
|
|
|
153 |
contact_info.get('contact', 'No Contact')
|
154 |
))
|
155 |
|
156 |
+
# Now return results and the file path of the CSV
|
157 |
+
csv_file_path = save_results_to_csv(results)
|
158 |
+
return results, csv_file_path
|
159 |
+
|
160 |
+
# Function to save results to CSV
|
161 |
+
def save_results_to_csv(results):
|
162 |
+
df = pd.DataFrame(results, columns=["Resume File", "Similarity Score (%)", "Eligibility", "Candidate Name", "Leadership Experience", "Email", "Contact"])
|
163 |
+
csv_file = "/tmp/results.csv"
|
164 |
+
df.to_csv(csv_file, index=False)
|
165 |
+
return csv_file # Return the file path
|
166 |
|
167 |
# Gradio Interface Components
|
168 |
job_desc_input = gr.File(label="Upload Job Description (TXT)", type="filepath")
|
|
|
180 |
label="Analysis Results"
|
181 |
)
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
# Gradio Interface
|
184 |
interface = gr.Interface(
|
185 |
fn=check_similarity,
|
186 |
inputs=[job_desc_input, resumes_input],
|
187 |
+
outputs=[results_output, gr.File(label="Download CSV")], # Now works properly without value
|
188 |
title="HR Assistant - Resume Screening & Leadership Experience",
|
189 |
description="Upload job description and resumes to screen candidates for managerial and team leadership roles and extract candidate details.",
|
190 |
allow_flagging="never"
|