ruslanmv commited on
Commit
7105896
·
verified ·
1 Parent(s): ea32e64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -153,8 +153,8 @@ with demo:
153
 
154
  with gr.Tab("CV Analyzer"):
155
  gr.Markdown("### Upload your CV and provide the job description")
156
- # IMPORTANT: set type="bytes" so we get raw bytes in parse_cv
157
- file_input = gr.File(label="Upload CV", type="bytes")
158
  job_desc_input = gr.Textbox(label="Job Description", lines=5)
159
 
160
  extracted_text = gr.Textbox(label="Extracted CV Content", lines=10, interactive=False)
@@ -166,7 +166,7 @@ with demo:
166
  analyze_button = gr.Button("Analyze CV")
167
 
168
  analyze_button.click(
169
- parse_cv,
170
  inputs=[file_input, job_desc_input],
171
  outputs=[extracted_text, analysis_output],
172
  ).then(
@@ -182,4 +182,4 @@ with demo:
182
  )
183
 
184
  if __name__ == "__main__":
185
- demo.queue().launch()
 
153
 
154
  with gr.Tab("CV Analyzer"):
155
  gr.Markdown("### Upload your CV and provide the job description")
156
+ # IMPORTANT: set type="file" and file_types to handle multiple file types
157
+ file_input = gr.File(label="Upload CV", type="file", file_types=['.pdf', '.docx'])
158
  job_desc_input = gr.Textbox(label="Job Description", lines=5)
159
 
160
  extracted_text = gr.Textbox(label="Extracted CV Content", lines=10, interactive=False)
 
166
  analyze_button = gr.Button("Analyze CV")
167
 
168
  analyze_button.click(
169
+ lambda file, job_desc: parse_cv(file.read(), job_desc) if file else ("Please upload a CV", ""),
170
  inputs=[file_input, job_desc_input],
171
  outputs=[extracted_text, analysis_output],
172
  ).then(
 
182
  )
183
 
184
  if __name__ == "__main__":
185
+ demo.queue().launch()