EdBoy2202 commited on
Commit
b02478c
·
verified ·
1 Parent(s): 8b82700

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -249,8 +249,8 @@ def quiz_app():
249
  st.session_state.score = 0
250
 
251
 
252
- # Initial topic input in main area - Shown only if quiz not started or topic was from sidebar (new quiz from sidebar)
253
- if not st.session_state.quiz_started or st.session_state.topic_from_sidebar:
254
  initial_topic = st.text_input("Enter the topic for your quiz:", value=st.session_state.get('quiz_topic', '') if not st.session_state.topic_from_sidebar else "") # Keep value if not from sidebar, clear if from sidebar
255
  if st.button("Generate Quiz"): # Button to generate quiz from initial input
256
  if initial_topic:
@@ -339,8 +339,8 @@ def quiz_app():
339
  else: # else associated with inner if parsed_quiz_data
340
  st.error("Failed to parse quiz content. Please try generating again.")
341
  st.session_state.quiz_data = None
342
- else: # else associated with outer if quiz_content
343
- st.error("Failed to generate quiz content. Please try again or check your API key.") # Corrected indentation here
344
 
345
  except Exception as e:
346
  st.error(f"An error occurred: {e}")
 
249
  st.session_state.score = 0
250
 
251
 
252
+ # Initial topic input in main area - Shown only if quiz not started
253
+ if not st.session_state.quiz_started: # Modified condition here
254
  initial_topic = st.text_input("Enter the topic for your quiz:", value=st.session_state.get('quiz_topic', '') if not st.session_state.topic_from_sidebar else "") # Keep value if not from sidebar, clear if from sidebar
255
  if st.button("Generate Quiz"): # Button to generate quiz from initial input
256
  if initial_topic:
 
339
  else: # else associated with inner if parsed_quiz_data
340
  st.error("Failed to parse quiz content. Please try generating again.")
341
  st.session_state.quiz_data = None
342
+ else: # else associated with outer if quiz_content
343
+ st.error("Failed to generate quiz content. Please try again or check your API key.")
344
 
345
  except Exception as e:
346
  st.error(f"An error occurred: {e}")