careerv3 / career.py
ombhojane's picture
Upload 88 files
8d404bc verified
raw
history blame
1.69 kB
import streamlit as st
import json
def app():
st.header("Career Priorities")
st.write("Rate the following aspects of your career according to your priority, and provide reasons for your choices.")
career_priorities = [
"Money",
"Benefits",
"Creative control",
"Flexible work options",
"Proximity to home/school/daycare",
"Challenge",
"Social connections and camaraderie",
"Measurable success",
]
if 'priorities_data' not in st.session_state:
st.session_state.priorities_data = {aspect: {"rating": None, "reason": ""} for aspect in career_priorities}
for aspect in career_priorities:
with st.expander(f"Rate and Explain: {aspect}"):
current_rating = st.session_state.priorities_data[aspect]["rating"]
current_reason = st.session_state.priorities_data[aspect]["reason"]
st.session_state.priorities_data[aspect]["rating"] = st.slider(
"Priority Rating", min_value=1, max_value=8, value=current_rating if current_rating else 1, key=f"slider_{aspect}"
)
st.session_state.priorities_data[aspect]["reason"] = st.text_area(
"Why is this important to you?", value=current_reason, key=f"text_{aspect}"
)
if st.button('Save Answers'):
save_priorities_data(st.session_state.priorities_data)
st.success('Career Priorities saved successfully!')
def save_priorities_data(data):
"""Save the priorities data to a JSON file."""
with open('career_priorities_data.json', 'w') as file:
json.dump(data, file, indent=4)
if __name__ == "__main__":
app()