EdBoy2202 commited on
Commit
3ec2b4a
·
verified ·
1 Parent(s): 88ad4b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -245,11 +245,15 @@ if topic:
245
  st.session_state.quiz_completed = False
246
  st.session_state.score = 0
247
  st.success(f"Quiz on '{topic}' generated successfully! Let's begin.")
248
- else:
249
  st.error("Failed to parse quiz content. Please try generating again.")
250
  st.session_state.quiz_data = None
251
- else:
252
- st.error("Failed to generate quiz content. Please try again or check your API key.")
 
 
 
 
253
 
254
  # Quiz Display Logic
255
  if st.session_state.quiz_data:
 
245
  st.session_state.quiz_completed = False
246
  st.session_state.score = 0
247
  st.success(f"Quiz on '{topic}' generated successfully! Let's begin.")
248
+ elif quiz_content: # **CHANGED to ELIF**
249
  st.error("Failed to parse quiz content. Please try generating again.")
250
  st.session_state.quiz_data = None
251
+ else:
252
+ st.error("Failed to generate quiz content. Please try again or check your API key.")
253
+
254
+ except Exception as e:
255
+ st.error(f"An error occurred: {e}")
256
+ st.error("Please check your API key and network connection. If the problem persists, try a different topic or try again later.")
257
 
258
  # Quiz Display Logic
259
  if st.session_state.quiz_data: