Spaces:
Sleeping
Sleeping
File size: 4,725 Bytes
a3280e8 0126cb1 a3280e8 1259f25 a3280e8 18b432b 9e9de90 18b432b a3280e8 9e9de90 a3280e8 9e9de90 a3280e8 18b432b a3280e8 9e9de90 dc774e7 18b432b 8cda49f a3280e8 9e9de90 c22222c 18b432b a3280e8 56b5571 a3280e8 dc774e7 a3280e8 18b432b 9e9de90 18b432b 9e9de90 56b5571 9e9de90 18b432b 9e9de90 56b5571 9e9de90 56b5571 9e9de90 18b432b 9e9de90 18b432b 9e9de90 56b5571 9e9de90 8cda49f a3280e8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
import streamlit as st
from streamlit_js_eval import streamlit_js_eval
from azure.storage.blob import BlobServiceClient
import json
import os
import uuid
connection_string = os.getenv("CONNECTION")
blob_service_client = BlobServiceClient.from_connection_string(connection_string)
def upload_blob(pdf_name, json_data, pdf_data_jobdescription,pdf_data_cv):
try:
container_name = "jobdescriptions"
json_blob_name = f"{pdf_name}_jsondata.json"
pdf_blob_name_jobdescription = f"{pdf_name}.pdf"
pdf_blob_name_cv = f"{pdf_name}_resume.pdf"
container_client = blob_service_client.get_container_client(container_name)
json_blob_client = container_client.get_blob_client(json_blob_name)
json_blob_client.upload_blob(json_data.encode('utf-8'), overwrite=True)
pdf_blob_client = container_client.get_blob_client(pdf_blob_name_jobdescription)
pdf_blob_client.upload_blob(pdf_data_jobdescription, overwrite=True)
pdf_blob_client = container_client.get_blob_client(pdf_blob_name_cv)
pdf_blob_client.upload_blob(pdf_data_cv, overwrite=True)
link = "https://tensora.ai/workgenius/cv-evaluation2/?job="+pdf_name
st.success('Data and PDF files have been successfully uploaded. The link to the chatbot for the potential candidate is the following: ')
st.write(link)
return True
except Exception as e:
print(f"Fehler beim Hochladen der Daten: {str(e)}")
return False
def test(text_val):
print(text_val)
if 'questions' not in st.session_state:
st.session_state.questions = []
def main():
st.markdown(
"""
<style>
[data-testid=column]{
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
</style>
""",
unsafe_allow_html=True,
)
col1, col2 = st.columns([2, 1])
col1.title("Job description upload")
col2.image("https://www.workgenius.com/wp-content/uploads/2023/03/WorkGenius_navy-1.svg")
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.")
upload_success = True
with st.form("job_inputs",clear_on_submit=True):
uploaded_file_jobdescription = st.file_uploader("Upload the job description:", type=["pdf"])
uploaded_file_cv = st.file_uploader("Upload the resume:", type=["pdf"])
job_title = st.text_input("Enter the job title:")
email = st.text_input("Enter the email:")
with st.expander("Enter up to three predefined questions if needed. Otherwise leave it blank:"):
question_one = st.text_input("Enter the first question:")
question_two = st.text_input("Enter the second question:")
question_three = st.text_input("Enter the third question:")
submitted = st.form_submit_button("Submit")
if submitted:
if len(job_title) > 0 and len(email) > 0 and uploaded_file_jobdescription and uploaded_file_cv:
data = {
"title": job_title,
"email": email,
"question_one": "",
"question_two": "",
"question_three": "",
}
if question_one:
data["question_one"] = question_one
if question_two:
data["question_two"] = question_two
if question_three:
data["question_three"] = question_three
json_data = json.dumps(data, ensure_ascii=False)
# Eine zufällige UUID generieren
random_uuid = uuid.uuid4()
# Die UUID als String darstellen
uuid_string = str(random_uuid)
pdf_name = uuid_string
pdf_data_jobdescription = uploaded_file_jobdescription.read()
pdf_data_cv = uploaded_file_cv.read()
upload_success = upload_blob(pdf_name, json_data, pdf_data_jobdescription,pdf_data_cv)
else:
st.write("Please fill out both fields and upload a PDF file.")
if not upload_success:
st.error('An error has occurred. Please contact the administrator. Sorry for the inconvenience.', icon="🚨")
else:
col_empty, col_btn = st.columns([5, 1])
if col_btn.button("Clear" ,key="clear_btn",use_container_width=True):
streamlit_js_eval(js_expressions="parent.window.location.reload()")
if __name__ == "__main__":
main() |