new
Browse files- cv_match/cv_match.py +48 -0
cv_match/cv_match.py
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import gradio as gr
|
3 |
+
import json
|
4 |
+
from PIL import Image
|
5 |
+
from gradio_client import Client, handle_file
|
6 |
+
|
7 |
+
hf_key = os.environ['HF_API_KEY']
|
8 |
+
client_url = os.environ['BK_URL']
|
9 |
+
|
10 |
+
client = Client(client_url, hf_token=hf_key)
|
11 |
+
def proc_pdf_cvs(pdf_cv_list, job_opp_list):
|
12 |
+
print(f"PDF CV list: {pdf_cv_list} & Job Opp list:{job_opp_list}")
|
13 |
+
|
14 |
+
final_res = ""
|
15 |
+
for pf in pdf_cv_list:
|
16 |
+
res = client.predict(
|
17 |
+
pdf_list=[handle_file(pf)],
|
18 |
+
job_opp_list=handle_file(job_opp_list),
|
19 |
+
api_name="/tmp_proc_pdf_cvs"
|
20 |
+
)
|
21 |
+
|
22 |
+
final_res += res + "\n\n"
|
23 |
+
|
24 |
+
print(f"Resp: {final_res}")
|
25 |
+
return final_res
|
26 |
+
|
27 |
+
with gr.Blocks() as cvm_app:
|
28 |
+
gr.Markdown("# CV-JD match maker")
|
29 |
+
gr.Markdown("Upload the Job description using csv template given. Download the template and fill it and upload it.")
|
30 |
+
gr.Markdown("Upload the Multiple PDF CV files. Ensure all your CVs are in same folder so you can choose multiple PDF files while selecting.")
|
31 |
+
gr.Markdown("Press Generate Match to generate a match result that lists for each candidate a match score and resons for each Job opening. ")
|
32 |
+
gr.Markdown("## Upload Job Description")
|
33 |
+
|
34 |
+
job_opp_list = gr.File(file_count="single", file_types=[".csv"])
|
35 |
+
dsjdf = gr.DownloadButton("Download sample Job description csv file template", visible=True,value= "jobs.csv")
|
36 |
+
|
37 |
+
gr.Markdown("## Upload PDF CV files")
|
38 |
+
#pdf_cv_list = gr.UploadButton("Upload a file", file_count="multiple", file_types=[".pdf"])
|
39 |
+
pdf_cv_list = gr.File(file_count="multiple", file_types=[".pdf"])
|
40 |
+
match_btn = gr.Button("Generate Match Result")
|
41 |
+
match_res = gr.Textbox(label="Match Result:", interactive=False)
|
42 |
+
|
43 |
+
match_btn.click(
|
44 |
+
proc_pdf_cvs,
|
45 |
+
inputs=[pdf_cv_list, job_opp_list],
|
46 |
+
outputs=[match_res]
|
47 |
+
)
|
48 |
+
|