Jintonic92 commited on
Commit
af3db8d
·
verified ·
1 Parent(s): c00d243

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -10
app.py CHANGED
@@ -5,7 +5,6 @@ from src.SecondModule.module2 import SimilarQuestionGenerator
5
  from src.ThirdModule.module3 import AnswerVerifier
6
  import logging
7
  from typing import Optional, Tuple
8
- #from latex_formatter import LatexFormatter # LaTeX 포맷터 import
9
  from pylatexenc.latex2text import LatexNodes2Text
10
  import re
11
 
@@ -339,15 +338,20 @@ def update_similar_question_display(new_question, i, answered=False):
339
  """Display similar question and its options"""
340
  display_math_content(new_question['question'])
341
 
342
- col1, col2 = st.columns(2)
343
- for j, (col, opt) in enumerate([(col1, 'A'), (col1, 'C'), (col2, 'B'), (col2, 'D')]):
344
- with col:
345
- st.markdown(f"### {opt})")
346
- display_option_content(new_question['choices'][opt])
347
- if not answered:
348
- if st.button("선택", key=f"similar_{opt}_{i}"):
349
- handle_similar_answer(opt, i)
350
- st.rerun()
 
 
 
 
 
351
 
352
  def main():
353
  """메인 애플리케이션 로직"""
 
5
  from src.ThirdModule.module3 import AnswerVerifier
6
  import logging
7
  from typing import Optional, Tuple
 
8
  from pylatexenc.latex2text import LatexNodes2Text
9
  import re
10
 
 
338
  """Display similar question and its options"""
339
  display_math_content(new_question['question'])
340
 
341
+ # Display options
342
+ for opt in ['A', 'B', 'C', 'D']:
343
+ with st.container():
344
+ col1, col2 = st.columns([1, 11])
345
+ with col1:
346
+ if st.button(f"{opt}.", key=f"sim_btn_{opt}_{i}", help="Click to select"):
347
+ if not answered:
348
+ st.session_state[f"similar_question_answered_{i}"] = True
349
+ st.session_state[f"selected_answer_{i}"] = opt
350
+ correct_answer = st.session_state.get('current_similar_question_answer')
351
+ st.session_state[f"is_correct_{i}"] = (opt == correct_answer)
352
+ st.rerun()
353
+ with col2:
354
+ display_option_content(new_question['choices'][opt])
355
 
356
  def main():
357
  """메인 애플리케이션 로직"""