Update app.py
Browse files
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', '')
|
| 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 |
-
|
| 343 |
-
|
| 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}")
|