Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -373,19 +373,6 @@ def main():
|
|
373 |
elif st.session_state.game_state == "gameplay":
|
374 |
with st.container():
|
375 |
progress = (st.session_state.current_q + 1) / 20
|
376 |
-
questions_left = 20 - (st.session_state.current_q + 1) # Add this line
|
377 |
-
|
378 |
-
# ===== DYNAMIC BACKGROUND =====
|
379 |
-
bg_color = "#FFEBEE" if questions_left < 5 else "#E8F5E9"
|
380 |
-
st.markdown(f"""
|
381 |
-
<style>
|
382 |
-
.stApp {{
|
383 |
-
background: {bg_color};
|
384 |
-
transition: background 0.5s ease;
|
385 |
-
}}
|
386 |
-
</style>
|
387 |
-
""", unsafe_allow_html=True)
|
388 |
-
# ===== END BACKGROUND =====
|
389 |
st.markdown(f"""
|
390 |
<div class="question-count">QUESTION {st.session_state.current_q + 1} OF 20</div>
|
391 |
<div class="progress-bar">
|
@@ -436,7 +423,7 @@ def main():
|
|
436 |
st.session_state.conversation_history.append(
|
437 |
{"role": "assistant", "content": next_response}
|
438 |
)
|
439 |
-
st.session_state.current_q
|
440 |
if st.session_state.current_q >= 20:
|
441 |
st.session_state.game_state = "result"
|
442 |
st.experimental_rerun()
|
@@ -496,7 +483,7 @@ def main():
|
|
496 |
st.session_state.conversation_history.append(
|
497 |
{"role": "assistant", "content": next_response}
|
498 |
)
|
499 |
-
st.session_state.current_q
|
500 |
st.experimental_rerun()
|
501 |
|
502 |
elif st.session_state.game_state == "result":
|
|
|
373 |
elif st.session_state.game_state == "gameplay":
|
374 |
with st.container():
|
375 |
progress = (st.session_state.current_q + 1) / 20
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
st.markdown(f"""
|
377 |
<div class="question-count">QUESTION {st.session_state.current_q + 1} OF 20</div>
|
378 |
<div class="progress-bar">
|
|
|
423 |
st.session_state.conversation_history.append(
|
424 |
{"role": "assistant", "content": next_response}
|
425 |
)
|
426 |
+
st.session_state.current_q
|
427 |
if st.session_state.current_q >= 20:
|
428 |
st.session_state.game_state = "result"
|
429 |
st.experimental_rerun()
|
|
|
483 |
st.session_state.conversation_history.append(
|
484 |
{"role": "assistant", "content": next_response}
|
485 |
)
|
486 |
+
st.session_state.current_q
|
487 |
st.experimental_rerun()
|
488 |
|
489 |
elif st.session_state.game_state == "result":
|