vladyslav commited on
Commit
7958dfb
·
1 Parent(s): 49dd514

Fixed required student_name and class_name. Made feedback required

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -99,6 +99,15 @@ def get_next_question(selected_answer):
99
  def summarize_results(student_name, class_name, model, book, feedback, rating):
100
  global questions_data, answers_log
101
  questions = []
 
 
 
 
 
 
 
 
 
102
  for question, answer in zip(questions_data, answers_log):
103
  questions.append({
104
  "question": question,
@@ -145,8 +154,8 @@ with gr.Blocks() as demo:
145
  submit_feedback_button = gr.Button("Завершити тест", visible=False)
146
 
147
 
148
- def update_question(model, book):
149
- question, answers = load_questions(model, book, student_name_input, class_name_input)
150
  is_field_filled = len(answers) > 0
151
  return (
152
  question, # question_output
@@ -160,7 +169,7 @@ with gr.Blocks() as demo:
160
 
161
  load_button.click(
162
  update_question,
163
- inputs=[model_radio, book_radio],
164
  outputs=[question_output, answer_radio, next_button, feedback_input, rating_slider, submit_feedback_button]
165
  )
166
 
 
99
  def summarize_results(student_name, class_name, model, book, feedback, rating):
100
  global questions_data, answers_log
101
  questions = []
102
+
103
+ if not feedback:
104
+ return (
105
+ "# Залиште відгук про тест!", # question_output
106
+ gr.update(visible=True), # feedback_input
107
+ gr.update(visible=True), # rating_slider
108
+ gr.update(visible=True) # submit_feedback_button
109
+ )
110
+
111
  for question, answer in zip(questions_data, answers_log):
112
  questions.append({
113
  "question": question,
 
154
  submit_feedback_button = gr.Button("Завершити тест", visible=False)
155
 
156
 
157
+ def update_question(model, book, student_name, class_name):
158
+ question, answers = load_questions(model, book, student_name, class_name)
159
  is_field_filled = len(answers) > 0
160
  return (
161
  question, # question_output
 
169
 
170
  load_button.click(
171
  update_question,
172
+ inputs=[model_radio, book_radio, student_name_input, class_name_input],
173
  outputs=[question_output, answer_radio, next_button, feedback_input, rating_slider, submit_feedback_button]
174
  )
175