Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -238,14 +238,22 @@ def main():
|
|
238 |
st.info(f"Misconception ID: {int(misconception_id)}\n\n{misconception_text}")
|
239 |
else:
|
240 |
st.info("Misconception μ λ³΄κ° μμ΅λλ€.")
|
241 |
-
|
242 |
-
#
|
243 |
-
#
|
244 |
-
#
|
245 |
-
#
|
246 |
-
#
|
247 |
-
#
|
248 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
# μ μ¬ λ¬Έμ μμ± λ²νΌ
|
250 |
if st.button(f"π μ μ¬ λ¬Έμ νκΈ° #{i + 1}", key=f"retry_{i}"):
|
251 |
with st.spinner("μ μ¬ λ¬Έμ λ₯Ό μμ±νκ³ μμ΅λλ€..."):
|
@@ -254,13 +262,63 @@ def main():
|
|
254 |
if new_question:
|
255 |
st.write("### π― μ μ¬ λ¬Έμ ")
|
256 |
st.write(new_question['question'])
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
else:
|
263 |
st.error("μ μ¬ λ¬Έμ λ₯Ό μμ±ν μ μμ΅λλ€.")
|
|
|
|
|
264 |
if __name__ == "__main__":
|
265 |
main()
|
266 |
|
|
|
238 |
st.info(f"Misconception ID: {int(misconception_id)}\n\n{misconception_text}")
|
239 |
else:
|
240 |
st.info("Misconception μ λ³΄κ° μμ΅λλ€.")
|
241 |
+
|
242 |
+
# # μ μ¬ λ¬Έμ μμ± λ²νΌ
|
243 |
+
# if st.button(f"π μ μ¬ λ¬Έμ νκΈ° #{i + 1}", key=f"retry_{i}"):
|
244 |
+
# with st.spinner("μ μ¬ λ¬Έμ λ₯Ό μμ±νκ³ μμ΅λλ€..."):
|
245 |
+
# logger.info(f"Generating similar question for misconception_id: {misconception_id}")
|
246 |
+
# new_question = generate_similar_question(wrong_q, misconception_id, generator)
|
247 |
+
# if new_question:
|
248 |
+
# st.write("### π― μ μ¬ λ¬Έμ ")
|
249 |
+
# st.write(new_question['question'])
|
250 |
+
# st.write("**보기:**")
|
251 |
+
# for choice, text in new_question['choices'].items():
|
252 |
+
# st.write(f"{choice}) {text}")
|
253 |
+
# st.write("**β
μ λ΅:**", new_question['correct'])
|
254 |
+
# st.write("**π ν΄μ€:**", new_question['explanation'])
|
255 |
+
# else:
|
256 |
+
# st.error("μ μ¬ λ¬Έμ λ₯Ό μμ±ν μ μμ΅λλ€.")
|
257 |
# μ μ¬ λ¬Έμ μμ± λ²νΌ
|
258 |
if st.button(f"π μ μ¬ λ¬Έμ νκΈ° #{i + 1}", key=f"retry_{i}"):
|
259 |
with st.spinner("μ μ¬ λ¬Έμ λ₯Ό μμ±νκ³ μμ΅λλ€..."):
|
|
|
262 |
if new_question:
|
263 |
st.write("### π― μ μ¬ λ¬Έμ ")
|
264 |
st.write(new_question['question'])
|
265 |
+
|
266 |
+
# μ λ΅μ μΈμ
μ€ν
μ΄νΈμ μ μ₯
|
267 |
+
if f"similar_question_answered_{i}" not in st.session_state:
|
268 |
+
st.session_state[f"similar_question_answered_{i}"] = False
|
269 |
+
if f"similar_question_correct_{i}" not in st.session_state:
|
270 |
+
st.session_state[f"similar_question_correct_{i}"] = new_question['correct']
|
271 |
+
|
272 |
+
# μμ§ λ΅λ³νμ§ μμ κ²½μ°μλ§ λ³΄κΈ° λ²νΌ νμ
|
273 |
+
if not st.session_state[f"similar_question_answered_{i}"]:
|
274 |
+
st.write("**보기:**")
|
275 |
+
col1, col2 = st.columns(2)
|
276 |
+
with col1:
|
277 |
+
if st.button(f"A) {new_question['choices']['A']}", key=f"similar_A_{i}"):
|
278 |
+
st.session_state[f"similar_question_answered_{i}"] = True
|
279 |
+
if 'A' == new_question['correct']:
|
280 |
+
st.success("β
μ λ΅μ
λλ€!")
|
281 |
+
else:
|
282 |
+
st.error("β νλ Έμ΅λλ€.")
|
283 |
+
st.rerun()
|
284 |
+
|
285 |
+
if st.button(f"C) {new_question['choices']['C']}", key=f"similar_C_{i}"):
|
286 |
+
st.session_state[f"similar_question_answered_{i}"] = True
|
287 |
+
if 'C' == new_question['correct']:
|
288 |
+
st.success("β
μ λ΅μ
λλ€!")
|
289 |
+
else:
|
290 |
+
st.error("β νλ Έμ΅λλ€.")
|
291 |
+
st.rerun()
|
292 |
+
|
293 |
+
with col2:
|
294 |
+
if st.button(f"B) {new_question['choices']['B']}", key=f"similar_B_{i}"):
|
295 |
+
st.session_state[f"similar_question_answered_{i}"] = True
|
296 |
+
if 'B' == new_question['correct']:
|
297 |
+
st.success("β
μ λ΅μ
λλ€!")
|
298 |
+
else:
|
299 |
+
st.error("β νλ Έμ΅λλ€.")
|
300 |
+
st.rerun()
|
301 |
+
|
302 |
+
if st.button(f"D) {new_question['choices']['D']}", key=f"similar_D_{i}"):
|
303 |
+
st.session_state[f"similar_question_answered_{i}"] = True
|
304 |
+
if 'D' == new_question['correct']:
|
305 |
+
st.success("β
μ λ΅μ
λλ€!")
|
306 |
+
else:
|
307 |
+
st.error("β νλ Έμ΅λλ€.")
|
308 |
+
st.rerun()
|
309 |
+
|
310 |
+
# λ΅λ³ν κ²½μ° κ²°κ³Ό λ° ν΄μ€ νμ
|
311 |
+
if st.session_state[f"similar_question_answered_{i}"]:
|
312 |
+
st.write("---")
|
313 |
+
st.write("**π ν΄μ€:**", new_question['explanation'])
|
314 |
+
# λ€μ νκΈ° λ²νΌ
|
315 |
+
if st.button("π λ€μ νκΈ°", key=f"reset_{i}"):
|
316 |
+
st.session_state[f"similar_question_answered_{i}"] = False
|
317 |
+
st.rerun()
|
318 |
else:
|
319 |
st.error("μ μ¬ λ¬Έμ λ₯Ό μμ±ν μ μμ΅λλ€.")
|
320 |
+
|
321 |
+
|
322 |
if __name__ == "__main__":
|
323 |
main()
|
324 |
|