burtenshaw commited on
Commit
6f9927c
·
1 Parent(s): 0a2ff23

disable start button if not logged in

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -133,10 +133,16 @@ def push_results_to_hub(user_answers, token: gr.OAuthToken | None):
133
 
134
 
135
 
136
- def handle_quiz(question_idx, user_answers, selected_answer, is_start):
 
 
137
  """
138
  Handle quiz state transitions and store answers
139
  """
 
 
 
 
140
  if not is_start and question_idx < len(quiz_data):
141
  current_q = quiz_data[question_idx]
142
  correct_reference = current_q["correct_answer"]
 
133
 
134
 
135
 
136
+ def handle_quiz(
137
+ question_idx, user_answers, selected_answer, is_start, token: gr.OAuthToken | None
138
+ ):
139
  """
140
  Handle quiz state transitions and store answers
141
  """
142
+ if token is None:
143
+ gr.Warning("Please log in to Hugging Face before starting the quiz!")
144
+ return
145
+
146
  if not is_start and question_idx < len(quiz_data):
147
  current_q = quiz_data[question_idx]
148
  correct_reference = current_q["correct_answer"]