careerv3 / values.py
ombhojane's picture
Upload 88 files
8d404bc verified
raw
history blame contribute delete
No virus
1.31 kB
import json
import streamlit as st
def app():
st.header("Identify Your Core Values")
core_value_questions = [
"What annoys you or gets under your skin at work?",
"What brings you joy in your work?",
"What could you not live without in a workplace or on a work team?",
"Who do you admire and what do you admire about them?"
]
if 'core_values_responses' not in st.session_state:
st.session_state['core_values_responses'] = {question: "" for question in core_value_questions}
def update_response(question):
new_value = st.session_state[question]
st.session_state.core_values_responses[question] = new_value
for question in core_value_questions:
st.text_input(
label=question,
value=st.session_state.core_values_responses[question],
key=question,
on_change=update_response,
args=(question,)
)
if st.button('Save Core Values', key='save'):
save_responses_to_file(st.session_state.core_values_responses)
st.success('Core Values saved!')
def save_responses_to_file(responses, file_path='core_values_responses.json'):
with open(file_path, 'w') as file:
json.dump(responses, file)
if __name__ == "__main__":
app()