Jintonic92 commited on
Commit
5b8bc29
ยท
verified ยท
1 Parent(s): 9dc334f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -8
app.py CHANGED
@@ -118,14 +118,6 @@ def generate_similar_question(wrong_q, misconception_id, generator):
118
  wrong_answer_text=input_data['wrong_answer_text'],
119
  misconception_id=input_data['misconception_id']
120
  )
121
- # Before module 3 integration code
122
- # if generated_q:
123
- # return {
124
- # 'question': generated_q.question,
125
- # 'choices': generated_q.choices,
126
- # 'correct': generated_q.correct_answer,
127
- # 'explanation': generated_q.explanation
128
- # }
129
 
130
  # integrating module3
131
  if generated_q:
@@ -164,6 +156,7 @@ def generate_similar_question(wrong_q, misconception_id, generator):
164
  # ์ •๋‹ต์„ ์„ธ์…˜ ์Šคํ…Œ์ดํŠธ์— ์ €์žฅ
165
  st.session_state['current_similar_question_answer'] = generated_q.correct_answer
166
  return result
 
167
  except Exception as e:
168
  logger.error(f"Error in generate_similar_question: {str(e)}")
169
  st.error(f"๋ฌธ์ œ ์ƒ์„ฑ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค: {str(e)}")
@@ -364,11 +357,24 @@ def main():
364
  st.session_state[f"selected_answer_{i}"] = None
365
  st.session_state[f"is_correct_{i}"] = None
366
  st.rerun()
 
 
 
 
 
 
 
367
  else:
368
  st.error("์œ ์‚ฌ ๋ฌธ์ œ๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.")
369
  if st.button("โŒ ๋‹ซ๊ธฐ", key=f"close_error_{i}"):
370
  st.session_state[f"show_similar_question_{i}"] = False
371
  st.rerun()
 
 
 
 
 
 
372
  if __name__ == "__main__":
373
  main()
374
 
 
118
  wrong_answer_text=input_data['wrong_answer_text'],
119
  misconception_id=input_data['misconception_id']
120
  )
 
 
 
 
 
 
 
 
121
 
122
  # integrating module3
123
  if generated_q:
 
156
  # ์ •๋‹ต์„ ์„ธ์…˜ ์Šคํ…Œ์ดํŠธ์— ์ €์žฅ
157
  st.session_state['current_similar_question_answer'] = generated_q.correct_answer
158
  return result
159
+
160
  except Exception as e:
161
  logger.error(f"Error in generate_similar_question: {str(e)}")
162
  st.error(f"๋ฌธ์ œ ์ƒ์„ฑ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค: {str(e)}")
 
357
  st.session_state[f"selected_answer_{i}"] = None
358
  st.session_state[f"is_correct_{i}"] = None
359
  st.rerun()
360
+
361
+ # ํ™”๋ฉด ์•„๋ž˜ ์—ฌ๋ฐฑ ์ถ”๊ฐ€
362
+ st.markdown("<br>" * 5, unsafe_allow_html=True) # 5์ค„์˜ ๋นˆ ์ค„ ์ถ”๊ฐ€
363
+ st.markdown("""
364
+ <div style="height: 100px;">
365
+ </div>
366
+ """, unsafe_allow_html=True) # ์ถ”๊ฐ€ ์—ฌ๋ฐฑ
367
  else:
368
  st.error("์œ ์‚ฌ ๋ฌธ์ œ๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.")
369
  if st.button("โŒ ๋‹ซ๊ธฐ", key=f"close_error_{i}"):
370
  st.session_state[f"show_similar_question_{i}"] = False
371
  st.rerun()
372
+ # ํ™”๋ฉด ์•„๋ž˜ ์—ฌ๋ฐฑ ์ถ”๊ฐ€
373
+ st.markdown("<br>" * 5, unsafe_allow_html=True) # 5์ค„์˜ ๋นˆ ์ค„ ์ถ”๊ฐ€
374
+ st.markdown("""
375
+ <div style="height: 100px;">
376
+ </div>
377
+ """, unsafe_allow_html=True) # ์ถ”๊ฐ€ ์—ฌ๋ฐฑ
378
  if __name__ == "__main__":
379
  main()
380