amitagh commited on
Commit
129c122
·
verified ·
1 Parent(s): 94ca5cb
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -23,7 +23,10 @@ def generate_quiz(grade, num_questions):
23
  if not grade or not num_questions:
24
  return [[], "Please select both grade and number of questions before generating the quiz."] + [gr.update(visible=False) for _ in range(5)]
25
 
26
- grade = int(grade)
 
 
 
27
  num_questions = int(num_questions)
28
 
29
  quiz = gen_quiz_ques_local(grade, num_questions)
@@ -73,9 +76,10 @@ def clear_quiz():
73
  with gr.Blocks() as app:
74
  gr.Markdown("# QuizWhiz: Your Quiz Master")
75
  gr.Markdown("Welcome to the ultimate trivia challenge! Whether you're a curious kid or a lifelong learner, this app is designed to test your knowledge and keep your mind sharp.")
 
76
  gr.Markdown("Press Generate to generate quiz questions. Press Submit once you are done answering. Press Clear to clear the questions.")
77
  with gr.Row():
78
- grade = gr.Dropdown(choices=[6], label="Grade", value=6)
79
  num_questions = gr.Dropdown(choices=[5, 10, 15, 20], label="Number of Questions", value=5)
80
  #num_questions = gr.Slider(minimum=1, maximum=MAX_ANS_COMP, step=1, value=10, label="Number of Questions")
81
  generate_btn = gr.Button("Generate Quiz")
 
23
  if not grade or not num_questions:
24
  return [[], "Please select both grade and number of questions before generating the quiz."] + [gr.update(visible=False) for _ in range(5)]
25
 
26
+ if grade == "Any":
27
+ grade = 10
28
+ else:
29
+ grade = int(grade)
30
  num_questions = int(num_questions)
31
 
32
  quiz = gen_quiz_ques_local(grade, num_questions)
 
76
  with gr.Blocks() as app:
77
  gr.Markdown("# QuizWhiz: Your Quiz Master")
78
  gr.Markdown("Welcome to the ultimate trivia challenge! Whether you're a curious kid or a lifelong learner, this app is designed to test your knowledge and keep your mind sharp.")
79
+ gr.Markdown("Select Kid school grade and number of questions to generate. Choose Any as grade for above 8th Grade or Adults.")
80
  gr.Markdown("Press Generate to generate quiz questions. Press Submit once you are done answering. Press Clear to clear the questions.")
81
  with gr.Row():
82
+ grade = gr.Dropdown(choices=[5, 6, 7, 8, "Any"], label="Grade", value=6)
83
  num_questions = gr.Dropdown(choices=[5, 10, 15, 20], label="Number of Questions", value=5)
84
  #num_questions = gr.Slider(minimum=1, maximum=MAX_ANS_COMP, step=1, value=10, label="Number of Questions")
85
  generate_btn = gr.Button("Generate Quiz")