Jintonic92 commited on
Commit
b8eae4d
ยท
verified ยท
1 Parent(s): 79ec0a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -50
app.py CHANGED
@@ -293,23 +293,8 @@ def update_similar_question_display(new_question, i, answered=False):
293
  st.rerun()
294
  with col2:
295
  display_option_content(new_question['choices'][opt])
296
- # def update_similar_question_display(new_question, i, answered=False):
297
- # """Display similar question and its options"""
298
- # display_math_content(new_question['question'])
299
- # st.write("**๋ณด๊ธฐ:**")
300
-
301
- # for opt in ['A', 'B', 'C', 'D']:
302
- # col1, col2 = st.columns([1, 11])
303
- # with col1:
304
- # if not answered:
305
- # if st.button(opt, key=f"sim_btn_{opt}_{i}"):
306
- # st.session_state[f"similar_question_answered_{i}"] = True
307
- # st.session_state[f"selected_answer_{i}"] = opt
308
- # correct_answer = st.session_state.get('current_similar_question_answer')
309
- # st.session_state[f"is_correct_{i}"] = (opt == correct_answer)
310
- # st.rerun()
311
- # with col2:
312
- # display_option_content(new_question['choices'][opt])
313
  def main():
314
  """๋ฉ”์ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋กœ์ง"""
315
  st.title("MisconcepTutor")
@@ -396,7 +381,6 @@ def main():
396
  st.write("**๐Ÿ“‹ ๋ฌธ์ œ:**")
397
  display_math_content(wrong_q['QuestionText']) # ๋ฌธ์ œ ๋ Œ๋”๋ง
398
  st.write("**โœ… ์ •๋‹ต:**")
399
- #display_math_content(wrong_q[f'Answer{wrong_q["CorrectAnswer"]}Text']) # ์ •๋‹ต ๋ Œ๋”๋ง
400
  display_option_content(wrong_q[f'Answer{wrong_q["CorrectAnswer"]}Text'])
401
 
402
  st.write("---")
@@ -421,44 +405,50 @@ def main():
421
 
422
  # ๋‹ต๋ณ€ ์ƒํƒœ ํ™•์ธ
423
  answered = st.session_state.get(f"similar_question_answered_{i}", False)
424
- update_similar_question_display(new_question, i, answered)
 
 
 
 
 
 
425
 
426
  # ๋ณด๊ธฐ ํ‘œ์‹œ
427
- st.write("**๋ณด๊ธฐ:**")
428
- col1, col2 = st.columns(2)
429
 
430
 
431
  # ๋‹ต๋ณ€ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ์—๋งŒ ๋ฒ„ํŠผ ํ™œ์„ฑํ™”
432
- if not answered:
433
- with col1:
434
- for option in ['A', 'C']:
435
- if st.button(
436
- f"{option}) {LatexNodes2Text().latex_to_text(new_question['choices'][option])}",
437
- key=f"similar_{option}_{i}"
438
- ):
439
- st.session_state[f"similar_question_answered_{i}"] = True
440
- st.session_state[f"selected_answer_{i}"] = option
441
- correct_answer = st.session_state.get('current_similar_question_answer')
442
- if option == correct_answer:
443
- st.session_state[f"is_correct_{i}"] = True
444
- else:
445
- st.session_state[f"is_correct_{i}"] = False
446
- st.rerun()
447
 
448
- with col2:
449
- for option in ['B', 'D']:
450
- if st.button(
451
- f"{option}) {LatexNodes2Text().latex_to_text(new_question['choices'][option])}",
452
- key=f"similar_{option}_{i}"
453
- ):
454
- st.session_state[f"similar_question_answered_{i}"] = True
455
- st.session_state[f"selected_answer_{i}"] = option
456
- correct_answer = st.session_state.get('current_similar_question_answer')
457
- if option == correct_answer:
458
- st.session_state[f"is_correct_{i}"] = True
459
- else:
460
- st.session_state[f"is_correct_{i}"] = False
461
- st.rerun()
462
 
463
  # ๋‹ต๋ณ€ํ•œ ๊ฒฝ์šฐ ๊ฒฐ๊ณผ ํ‘œ์‹œ
464
  if answered:
 
293
  st.rerun()
294
  with col2:
295
  display_option_content(new_question['choices'][opt])
296
+
297
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  def main():
299
  """๋ฉ”์ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋กœ์ง"""
300
  st.title("MisconcepTutor")
 
381
  st.write("**๐Ÿ“‹ ๋ฌธ์ œ:**")
382
  display_math_content(wrong_q['QuestionText']) # ๋ฌธ์ œ ๋ Œ๋”๋ง
383
  st.write("**โœ… ์ •๋‹ต:**")
 
384
  display_option_content(wrong_q[f'Answer{wrong_q["CorrectAnswer"]}Text'])
385
 
386
  st.write("---")
 
405
 
406
  # ๋‹ต๋ณ€ ์ƒํƒœ ํ™•์ธ
407
  answered = st.session_state.get(f"similar_question_answered_{i}", False)
408
+ #update_similar_question_display(new_question, i, answered)
409
+
410
+ display_question(question_text,
411
+ new_question['choices']['A'],
412
+ new_question['choices']['B'],
413
+ new_question['choices']['C'],
414
+ new_question['choices']['D'])
415
 
416
  # ๋ณด๊ธฐ ํ‘œ์‹œ
417
+ #st.write("**๋ณด๊ธฐ:**")
418
+ #col1, col2 = st.columns(2)
419
 
420
 
421
  # ๋‹ต๋ณ€ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ์—๋งŒ ๋ฒ„ํŠผ ํ™œ์„ฑํ™”
422
+ # if not answered:
423
+ # with col1:
424
+ # for option in ['A', 'C']:
425
+ # if st.button(
426
+ # f"{option}) {LatexNodes2Text().latex_to_text(new_question['choices'][option])}",
427
+ # key=f"similar_{option}_{i}"
428
+ # ):
429
+ # st.session_state[f"similar_question_answered_{i}"] = True
430
+ # st.session_state[f"selected_answer_{i}"] = option
431
+ # correct_answer = st.session_state.get('current_similar_question_answer')
432
+ # if option == correct_answer:
433
+ # st.session_state[f"is_correct_{i}"] = True
434
+ # else:
435
+ # st.session_state[f"is_correct_{i}"] = False
436
+ # st.rerun()
437
 
438
+ # with col2:
439
+ # for option in ['B', 'D']:
440
+ # if st.button(
441
+ # f"{option}) {LatexNodes2Text().latex_to_text(new_question['choices'][option])}",
442
+ # key=f"similar_{option}_{i}"
443
+ # ):
444
+ # st.session_state[f"similar_question_answered_{i}"] = True
445
+ # st.session_state[f"selected_answer_{i}"] = option
446
+ # correct_answer = st.session_state.get('current_similar_question_answer')
447
+ # if option == correct_answer:
448
+ # st.session_state[f"is_correct_{i}"] = True
449
+ # else:
450
+ # st.session_state[f"is_correct_{i}"] = False
451
+ # st.rerun()
452
 
453
  # ๋‹ต๋ณ€ํ•œ ๊ฒฝ์šฐ ๊ฒฐ๊ณผ ํ‘œ์‹œ
454
  if answered: