ChauHPham commited on
Commit
0095857
·
verified ·
1 Parent(s): b1d8025

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. gradio_quiz_app.py +9 -3
gradio_quiz_app.py CHANGED
@@ -228,6 +228,14 @@ def check_answer(user_answer, num_questions):
228
  f"Score: {some_score['correct']}/{some_score['total']} | Accuracy: {(some_score['correct']/some_score['total']*100) if some_score['total'] > 0 else 0:.0f}%"
229
  )
230
 
 
 
 
 
 
 
 
 
231
  def next_question(num_questions):
232
  if current_question >= num_questions:
233
  return start_quiz(num_questions)
@@ -303,8 +311,6 @@ with app:
303
  )
304
 
305
  # The Gradio 'app' object is now directly exposed without app.launch()
306
-
307
-
308
-
309
  if __name__ == "__main__":
310
  app.launch(share=True)
 
228
  f"Score: {some_score['correct']}/{some_score['total']} | Accuracy: {(some_score['correct']/some_score['total']*100) if some_score['total'] > 0 else 0:.0f}%"
229
  )
230
 
231
+ # Wrapper functions for Gradio buttons
232
+ def check_ai_answer(num_questions):
233
+ return check_answer('AI-generated', num_questions)
234
+
235
+ def check_human_answer(num_questions):
236
+ return check_answer('Human-written', num_questions)
237
+
238
+
239
  def next_question(num_questions):
240
  if current_question >= num_questions:
241
  return start_quiz(num_questions)
 
311
  )
312
 
313
  # The Gradio 'app' object is now directly exposed without app.launch()
314
+ # For local execution, include app.launch()
 
 
315
  if __name__ == "__main__":
316
  app.launch(share=True)