mbosse99 commited on
Commit
18b432b
·
1 Parent(s): 8cda49f

Adding second file upload for resume

Browse files
Files changed (1) hide show
  1. app.py +18 -11
app.py CHANGED
@@ -9,23 +9,27 @@ connection_string = os.getenv("CONNECTION")
9
  blob_service_client = BlobServiceClient.from_connection_string(connection_string)
10
 
11
 
12
- def upload_blob(pdf_name, json_data, pdf_data):
13
  try:
14
  container_name = "jobdescriptions"
15
  json_blob_name = f"{pdf_name}_jsondata.json"
16
- pdf_blob_name = f"{pdf_name}.pdf"
 
17
 
18
  container_client = blob_service_client.get_container_client(container_name)
19
 
20
  json_blob_client = container_client.get_blob_client(json_blob_name)
21
  json_blob_client.upload_blob(json_data.encode('utf-8'), overwrite=True)
22
 
23
- pdf_blob_client = container_client.get_blob_client(pdf_blob_name)
24
- pdf_blob_client.upload_blob(pdf_data, overwrite=True)
 
 
 
25
 
26
  link = "https://tensora.ai/workgenius/cv-evaluation2/?job="+pdf_name
27
 
28
- st.success('Data and PDF have been successfully uploaded. The link to the chatbot for the potential candidates is the following: ')
29
  st.write(link)
30
 
31
  return True
@@ -35,7 +39,8 @@ def upload_blob(pdf_name, json_data, pdf_data):
35
 
36
 
37
 
38
-
 
39
 
40
  def main():
41
  st.markdown(
@@ -57,16 +62,17 @@ def main():
57
  col1.title("Job description upload")
58
  col2.image("https://www.workgenius.com/wp-content/uploads/2023/03/WorkGenius_navy-1.svg")
59
 
60
- st.write("Please upload the job description as a PDF and enter the job title for the position. To receive the evaluation of the potential candidates, please enter your email address.")
61
  upload_success = True
62
  with st.form("job_inputs",clear_on_submit=True):
63
- uploaded_file = st.file_uploader("Upload a PDF file:", type=["pdf"])
 
64
 
65
  job_title = st.text_input("Enter the job title:")
66
  email = st.text_input("Enter the email:")
67
  submitted = st.form_submit_button("Submit")
68
  if submitted:
69
- if len(job_title) > 0 and len(email) > 0 and uploaded_file:
70
  data = {
71
  "title": job_title,
72
  "email": email
@@ -81,9 +87,10 @@ def main():
81
 
82
  pdf_name = uuid_string
83
 
84
- pdf_data = uploaded_file.read()
 
85
 
86
- upload_success = upload_blob(pdf_name, json_data, pdf_data)
87
 
88
 
89
  else:
 
9
  blob_service_client = BlobServiceClient.from_connection_string(connection_string)
10
 
11
 
12
+ def upload_blob(pdf_name, json_data, pdf_data_jobdescription,pdf_data_cv):
13
  try:
14
  container_name = "jobdescriptions"
15
  json_blob_name = f"{pdf_name}_jsondata.json"
16
+ pdf_blob_name_jobdescription = f"{pdf_name}.pdf"
17
+ pdf_blob_name_cv = f"{pdf_name}_resume.pdf"
18
 
19
  container_client = blob_service_client.get_container_client(container_name)
20
 
21
  json_blob_client = container_client.get_blob_client(json_blob_name)
22
  json_blob_client.upload_blob(json_data.encode('utf-8'), overwrite=True)
23
 
24
+ pdf_blob_client = container_client.get_blob_client(pdf_blob_name_jobdescription)
25
+ pdf_blob_client.upload_blob(pdf_data_jobdescription, overwrite=True)
26
+
27
+ pdf_blob_client = container_client.get_blob_client(pdf_blob_name_cv)
28
+ pdf_blob_client.upload_blob(pdf_data_cv, overwrite=True)
29
 
30
  link = "https://tensora.ai/workgenius/cv-evaluation2/?job="+pdf_name
31
 
32
+ st.success('Data and PDF files have been successfully uploaded. The link to the chatbot for the potential candidate is the following: ')
33
  st.write(link)
34
 
35
  return True
 
39
 
40
 
41
 
42
+ def test(text_val):
43
+ print(text_val)
44
 
45
  def main():
46
  st.markdown(
 
62
  col1.title("Job description upload")
63
  col2.image("https://www.workgenius.com/wp-content/uploads/2023/03/WorkGenius_navy-1.svg")
64
 
65
+ st.write("Please upload the job description and resume as PDF and enter the job title for the position. To receive the evaluation of the potential candidate, please provide your email address.")
66
  upload_success = True
67
  with st.form("job_inputs",clear_on_submit=True):
68
+ uploaded_file_jobdescription = st.file_uploader("Upload the job description:", type=["pdf"])
69
+ uploaded_file_cv = st.file_uploader("Upload the resume:", type=["pdf"])
70
 
71
  job_title = st.text_input("Enter the job title:")
72
  email = st.text_input("Enter the email:")
73
  submitted = st.form_submit_button("Submit")
74
  if submitted:
75
+ if len(job_title) > 0 and len(email) > 0 and uploaded_file_jobdescription and uploaded_file_cv:
76
  data = {
77
  "title": job_title,
78
  "email": email
 
87
 
88
  pdf_name = uuid_string
89
 
90
+ pdf_data_jobdescription = uploaded_file_jobdescription.read()
91
+ pdf_data_cv = uploaded_file_cv.read()
92
 
93
+ upload_success = upload_blob(pdf_name, json_data, pdf_data_jobdescription,pdf_data_cv)
94
 
95
 
96
  else: