Kunjan Shah commited on
Commit
d62dcb5
·
1 Parent(s): 37cab1f

Merge branch 'main' of https://github.com/kunjanshah0811/AI_Job_Matcher

Browse files
Files changed (1) hide show
  1. app.py +29 -13
app.py CHANGED
@@ -75,17 +75,35 @@ if st.session_state.page_stack[-1] == "Loading":
75
 
76
  if st.session_state.page_stack[-1] == "Summary":
77
  st.markdown(custom_css, unsafe_allow_html=True)
78
- st.session_state.user_answers = [st.session_state[f"user_answer_{ques}"] for ques in range(len(st.session_state.questions))]
79
- st.session_state.ai_answers = [st.session_state[f"llm_answer_{ques}"] for ques in range(len(st.session_state.questions))]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  st.session_state.scores = [
81
- [
82
- int(track_score["structure_star"]["score"]),
83
- int(track_score["depth"]["score"]),
84
- int(track_score["clarity"]["score"]),
85
- int(track_score["correctness"]["score"])
86
- ]
87
- for track_score in st.session_state.track_score
88
- ]
89
 
90
  if "summary_data" not in st.session_state:
91
  with st.spinner("Analyzing your interview performance..."):
@@ -541,6 +559,4 @@ with st.sidebar:
541
  st.session_state.resume_text = resume_text
542
  st.session_state.jd_text = jd_text
543
  st.session_state.page_stack.append("Loading")
544
- st.rerun()
545
-
546
-
 
75
 
76
  if st.session_state.page_stack[-1] == "Summary":
77
  st.markdown(custom_css, unsafe_allow_html=True)
78
+
79
+ # Initialize lists to store answers
80
+ user_answers = []
81
+ ai_answers = []
82
+
83
+ # Safely collect answers
84
+ for ques in range(len(st.session_state.questions)):
85
+ # Get user answer with fallback
86
+ user_answer = st.session_state.get(f"user_answer_{ques}", "No answer provided")
87
+ user_answers.append(user_answer)
88
+
89
+ # Get AI answer with fallback
90
+ ai_answer = st.session_state.get(f"llm_answer_{ques}", "No AI answer available")
91
+ ai_answers.append(ai_answer)
92
+
93
+ # Store in session state
94
+ st.session_state.user_answers = user_answers
95
+ st.session_state.ai_answers = ai_answers
96
+
97
+ # Get scores safely
98
  st.session_state.scores = [
99
+ [
100
+ int(track_score["structure_star"]["score"]),
101
+ int(track_score["depth"]["score"]),
102
+ int(track_score["clarity"]["score"]),
103
+ int(track_score["correctness"]["score"])
104
+ ]
105
+ for track_score in st.session_state.track_score
106
+ ] if st.session_state.get("track_score") else []
107
 
108
  if "summary_data" not in st.session_state:
109
  with st.spinner("Analyzing your interview performance..."):
 
559
  st.session_state.resume_text = resume_text
560
  st.session_state.jd_text = jd_text
561
  st.session_state.page_stack.append("Loading")
562
+ st.rerun()