Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -354,7 +354,9 @@ def main():
|
|
354 |
new_question = generate_similar_question(wrong_q, misconception_id, generator)
|
355 |
if new_question:
|
356 |
st.write("### ๐ฏ ์ ์ฌ ๋ฌธ์ ")
|
357 |
-
st.write(new_question['question'])
|
|
|
|
|
358 |
|
359 |
# ๋ต๋ณ ์ํ ํ์ธ
|
360 |
answered = st.session_state.get(f"similar_question_answered_{i}", False)
|
@@ -363,12 +365,43 @@ def main():
|
|
363 |
st.write("**๋ณด๊ธฐ:**")
|
364 |
col1, col2 = st.columns(2)
|
365 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
# ๋ต๋ณํ์ง ์์ ๊ฒฝ์ฐ์๋ง ๋ฒํผ ํ์ฑํ
|
367 |
if not answered:
|
368 |
with col1:
|
369 |
for option in ['A', 'C']:
|
370 |
if st.button(
|
371 |
-
f"{option}) {new_question['choices'][option]}",
|
372 |
key=f"similar_{option}_{i}"
|
373 |
):
|
374 |
st.session_state[f"similar_question_answered_{i}"] = True
|
@@ -383,7 +416,7 @@ def main():
|
|
383 |
with col2:
|
384 |
for option in ['B', 'D']:
|
385 |
if st.button(
|
386 |
-
f"{option}) {new_question['choices'][option]}",
|
387 |
key=f"similar_{option}_{i}"
|
388 |
):
|
389 |
st.session_state[f"similar_question_answered_{i}"] = True
|
@@ -394,7 +427,6 @@ def main():
|
|
394 |
else:
|
395 |
st.session_state[f"is_correct_{i}"] = False
|
396 |
st.rerun()
|
397 |
-
|
398 |
# ๋ต๋ณํ ๊ฒฝ์ฐ ๊ฒฐ๊ณผ ํ์
|
399 |
if answered:
|
400 |
is_correct = st.session_state.get(f"is_correct_{i}", False)
|
|
|
354 |
new_question = generate_similar_question(wrong_q, misconception_id, generator)
|
355 |
if new_question:
|
356 |
st.write("### ๐ฏ ์ ์ฌ ๋ฌธ์ ")
|
357 |
+
#st.write(new_question['question'])
|
358 |
+
display_math_question(new_question['question'])
|
359 |
+
|
360 |
|
361 |
# ๋ต๋ณ ์ํ ํ์ธ
|
362 |
answered = st.session_state.get(f"similar_question_answered_{i}", False)
|
|
|
365 |
st.write("**๋ณด๊ธฐ:**")
|
366 |
col1, col2 = st.columns(2)
|
367 |
|
368 |
+
# # ๋ต๋ณํ์ง ์์ ๊ฒฝ์ฐ์๋ง ๋ฒํผ ํ์ฑํ
|
369 |
+
# if not answered:
|
370 |
+
# with col1:
|
371 |
+
# for option in ['A', 'C']:
|
372 |
+
# if st.button(
|
373 |
+
# f"{option}) {new_question['choices'][option]}",
|
374 |
+
# key=f"similar_{option}_{i}"
|
375 |
+
# ):
|
376 |
+
# st.session_state[f"similar_question_answered_{i}"] = True
|
377 |
+
# st.session_state[f"selected_answer_{i}"] = option
|
378 |
+
# correct_answer = st.session_state.get('current_similar_question_answer')
|
379 |
+
# if option == correct_answer:
|
380 |
+
# st.session_state[f"is_correct_{i}"] = True
|
381 |
+
# else:
|
382 |
+
# st.session_state[f"is_correct_{i}"] = False
|
383 |
+
# st.rerun()
|
384 |
+
|
385 |
+
# with col2:
|
386 |
+
# for option in ['B', 'D']:
|
387 |
+
# if st.button(
|
388 |
+
# f"{option}) {new_question['choices'][option]}",
|
389 |
+
# key=f"similar_{option}_{i}"
|
390 |
+
# ):
|
391 |
+
# st.session_state[f"similar_question_answered_{i}"] = True
|
392 |
+
# st.session_state[f"selected_answer_{i}"] = option
|
393 |
+
# correct_answer = st.session_state.get('current_similar_question_answer')
|
394 |
+
# if option == correct_answer:
|
395 |
+
# st.session_state[f"is_correct_{i}"] = True
|
396 |
+
# else:
|
397 |
+
# st.session_state[f"is_correct_{i}"] = False
|
398 |
+
# st.rerun()
|
399 |
# ๋ต๋ณํ์ง ์์ ๊ฒฝ์ฐ์๋ง ๋ฒํผ ํ์ฑํ
|
400 |
if not answered:
|
401 |
with col1:
|
402 |
for option in ['A', 'C']:
|
403 |
if st.button(
|
404 |
+
f"{option}) {format_math_expression(new_question['choices'][option])}",
|
405 |
key=f"similar_{option}_{i}"
|
406 |
):
|
407 |
st.session_state[f"similar_question_answered_{i}"] = True
|
|
|
416 |
with col2:
|
417 |
for option in ['B', 'D']:
|
418 |
if st.button(
|
419 |
+
f"{option}) {format_math_expression(new_question['choices'][option])}",
|
420 |
key=f"similar_{option}_{i}"
|
421 |
):
|
422 |
st.session_state[f"similar_question_answered_{i}"] = True
|
|
|
427 |
else:
|
428 |
st.session_state[f"is_correct_{i}"] = False
|
429 |
st.rerun()
|
|
|
430 |
# ๋ต๋ณํ ๊ฒฝ์ฐ ๊ฒฐ๊ณผ ํ์
|
431 |
if answered:
|
432 |
is_correct = st.session_state.get(f"is_correct_{i}", False)
|