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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -251,7 +251,7 @@ def quiz_app():
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:
257
  st.session_state.quiz_started = True
@@ -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.")
344
 
345
  except Exception as e:
346
  st.error(f"An error occurred: {e}")
 
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', '') ) # Removed condition causing issue
255
  if st.button("Generate Quiz"): # Button to generate quiz from initial input
256
  if initial_topic:
257
  st.session_state.quiz_started = True
 
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}")