Jintonic92 commited on
Commit
8449d24
ยท
verified ยท
1 Parent(s): 8704ed6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -275,6 +275,25 @@ def display_option_content(option_text):
275
  st.markdown(f'<div class="math-container">{formatted_content}</div>', unsafe_allow_html=True)
276
 
277
  # ์ถ”๊ฐ€
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  def update_similar_question_display(new_question, i, answered=False):
279
  """Display similar question and its options"""
280
  display_math_content(new_question['question'])
@@ -286,15 +305,16 @@ def update_similar_question_display(new_question, i, answered=False):
286
  with col1:
287
  if st.button(f"{opt}.", key=f"sim_btn_{opt}_{i}", help="Click to select"):
288
  if not answered:
 
289
  st.session_state[f"similar_question_answered_{i}"] = True
290
  st.session_state[f"selected_answer_{i}"] = opt
291
  correct_answer = st.session_state.get('current_similar_question_answer')
 
292
  st.session_state[f"is_correct_{i}"] = (opt == correct_answer)
293
  st.rerun()
294
  with col2:
295
  display_option_content(new_question['choices'][opt])
296
 
297
-
298
  def main():
299
  """๋ฉ”์ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋กœ์ง"""
300
  st.title("MisconcepTutor")
 
275
  st.markdown(f'<div class="math-container">{formatted_content}</div>', unsafe_allow_html=True)
276
 
277
  # ์ถ”๊ฐ€
278
+ # def update_similar_question_display(new_question, i, answered=False):
279
+ # """Display similar question and its options"""
280
+ # display_math_content(new_question['question'])
281
+
282
+ # # Display options
283
+ # for opt in ['A', 'B', 'C', 'D']:
284
+ # with st.container():
285
+ # col1, col2 = st.columns([1, 11])
286
+ # with col1:
287
+ # if st.button(f"{opt}.", key=f"sim_btn_{opt}_{i}", help="Click to select"):
288
+ # if not answered:
289
+ # st.session_state[f"similar_question_answered_{i}"] = True
290
+ # st.session_state[f"selected_answer_{i}"] = opt
291
+ # correct_answer = st.session_state.get('current_similar_question_answer')
292
+ # st.session_state[f"is_correct_{i}"] = (opt == correct_answer)
293
+ # st.rerun()
294
+ # with col2:
295
+ # display_option_content(new_question['choices'][opt])
296
+
297
  def update_similar_question_display(new_question, i, answered=False):
298
  """Display similar question and its options"""
299
  display_math_content(new_question['question'])
 
305
  with col1:
306
  if st.button(f"{opt}.", key=f"sim_btn_{opt}_{i}", help="Click to select"):
307
  if not answered:
308
+ # ์„ ํƒํ•œ ์˜ต์…˜(opt)์„ st.session_state์— ์ €์žฅ
309
  st.session_state[f"similar_question_answered_{i}"] = True
310
  st.session_state[f"selected_answer_{i}"] = opt
311
  correct_answer = st.session_state.get('current_similar_question_answer')
312
+ # ์ •๋‹ต ์—ฌ๋ถ€๋ฅผ ํ™•์ธ
313
  st.session_state[f"is_correct_{i}"] = (opt == correct_answer)
314
  st.rerun()
315
  with col2:
316
  display_option_content(new_question['choices'][opt])
317
 
 
318
  def main():
319
  """๋ฉ”์ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋กœ์ง"""
320
  st.title("MisconcepTutor")