Spaces:
Running
Running
With question input
Browse files
app.py
CHANGED
|
@@ -42,6 +42,9 @@ def upload_blob(pdf_name, json_data, pdf_data_jobdescription,pdf_data_cv):
|
|
| 42 |
def test(text_val):
|
| 43 |
print(text_val)
|
| 44 |
|
|
|
|
|
|
|
|
|
|
| 45 |
def main():
|
| 46 |
st.markdown(
|
| 47 |
"""
|
|
@@ -70,13 +73,28 @@ def main():
|
|
| 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
|
|
|
|
|
|
|
|
|
|
| 79 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
json_data = json.dumps(data, ensure_ascii=False)
|
| 81 |
|
| 82 |
# Eine zufällige UUID generieren
|
|
@@ -85,16 +103,17 @@ def main():
|
|
| 85 |
# Die UUID als String darstellen
|
| 86 |
uuid_string = str(random_uuid)
|
| 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:
|
| 97 |
st.write("Please fill out both fields and upload a PDF file.")
|
|
|
|
|
|
|
| 98 |
if not upload_success:
|
| 99 |
st.error('An error has occurred. Please contact the administrator. Sorry for the inconvenience.', icon="🚨")
|
| 100 |
else:
|
|
|
|
| 42 |
def test(text_val):
|
| 43 |
print(text_val)
|
| 44 |
|
| 45 |
+
if 'questions' not in st.session_state:
|
| 46 |
+
st.session_state.questions = []
|
| 47 |
+
|
| 48 |
def main():
|
| 49 |
st.markdown(
|
| 50 |
"""
|
|
|
|
| 73 |
|
| 74 |
job_title = st.text_input("Enter the job title:")
|
| 75 |
email = st.text_input("Enter the email:")
|
| 76 |
+
with st.expander("Enter up to three predefined questions if needed. Otherwise leave it blank:"):
|
| 77 |
+
question_one = st.text_input("Enter the first question:")
|
| 78 |
+
question_two = st.text_input("Enter the second question:")
|
| 79 |
+
question_three = st.text_input("Enter the third question:")
|
| 80 |
+
|
| 81 |
submitted = st.form_submit_button("Submit")
|
| 82 |
if submitted:
|
| 83 |
if len(job_title) > 0 and len(email) > 0 and uploaded_file_jobdescription and uploaded_file_cv:
|
| 84 |
data = {
|
| 85 |
"title": job_title,
|
| 86 |
+
"email": email,
|
| 87 |
+
"question_one": "",
|
| 88 |
+
"question_two": "",
|
| 89 |
+
"question_three": "",
|
| 90 |
}
|
| 91 |
+
if question_one:
|
| 92 |
+
data["question_one"] = question_one
|
| 93 |
+
if question_two:
|
| 94 |
+
data["question_two"] = question_two
|
| 95 |
+
if question_three:
|
| 96 |
+
data["question_three"] = question_three
|
| 97 |
+
|
| 98 |
json_data = json.dumps(data, ensure_ascii=False)
|
| 99 |
|
| 100 |
# Eine zufällige UUID generieren
|
|
|
|
| 103 |
# Die UUID als String darstellen
|
| 104 |
uuid_string = str(random_uuid)
|
| 105 |
|
| 106 |
+
# pdf_name = uuid_string
|
| 107 |
+
pdf_name = "TestMon"
|
| 108 |
|
| 109 |
pdf_data_jobdescription = uploaded_file_jobdescription.read()
|
| 110 |
pdf_data_cv = uploaded_file_cv.read()
|
| 111 |
|
| 112 |
upload_success = upload_blob(pdf_name, json_data, pdf_data_jobdescription,pdf_data_cv)
|
|
|
|
|
|
|
| 113 |
else:
|
| 114 |
st.write("Please fill out both fields and upload a PDF file.")
|
| 115 |
+
|
| 116 |
+
|
| 117 |
if not upload_success:
|
| 118 |
st.error('An error has occurred. Please contact the administrator. Sorry for the inconvenience.', icon="🚨")
|
| 119 |
else:
|