vladyslav
commited on
Commit
·
a8e81a1
1
Parent(s):
c059dfd
New questions labels. Changed from input to radio (-2 to 2)
Browse files- app.py +29 -27
- utils/db.py +2 -2
app.py
CHANGED
@@ -68,7 +68,7 @@ def get_next_question(selected_answer):
|
|
68 |
gr.update(visible=False), # submit_feedback_button
|
69 |
gr.update(visible=False), # rating_text
|
70 |
gr.update(visible=False), # question_correct
|
71 |
-
gr.update(visible=False), #
|
72 |
gr.update(visible=False), # interesting_question
|
73 |
"", # feedback_questions_output
|
74 |
)
|
@@ -93,7 +93,7 @@ def get_next_question(selected_answer):
|
|
93 |
gr.update(visible=False), # submit_feedback_button
|
94 |
gr.update(visible=False), # rating_text
|
95 |
gr.update(visible=False), # question_correct
|
96 |
-
gr.update(visible=False), #
|
97 |
gr.update(visible=False), # interesting_question
|
98 |
"", # feedback_questions_output
|
99 |
)
|
@@ -110,7 +110,7 @@ def get_next_question(selected_answer):
|
|
110 |
gr.update(visible=True), # submit_feedback_button
|
111 |
gr.update(visible=True), # rating_text
|
112 |
gr.update(visible=True), # question_correct
|
113 |
-
gr.update(visible=True), #
|
114 |
gr.update(visible=True), # interesting_question
|
115 |
feedback_questions, # feedback_questions_output
|
116 |
)
|
@@ -123,19 +123,19 @@ def summarize_results(student_name,
|
|
123 |
feedback,
|
124 |
rating,
|
125 |
question_correct,
|
126 |
-
|
127 |
interesting_question):
|
128 |
global questions_data, answers_log, feedback_questions
|
129 |
questions = []
|
130 |
|
131 |
-
if not feedback or
|
132 |
return (
|
133 |
"# Залиште відгук про тест!", # question_output
|
134 |
gr.update(visible=True), # feedback_input
|
135 |
gr.update(visible=True), # rating_slider
|
136 |
gr.update(visible=True), # submit_feedback_button
|
137 |
gr.update(visible=True), # question_correct
|
138 |
-
gr.update(visible=True), #
|
139 |
gr.update(visible=True), # interesting_question
|
140 |
gr.update(visible=True), # rating_text
|
141 |
feedback_questions, # feedback_questions_output
|
@@ -157,7 +157,7 @@ def summarize_results(student_name,
|
|
157 |
feedback,
|
158 |
rating,
|
159 |
question_correct,
|
160 |
-
|
161 |
interesting_question
|
162 |
)
|
163 |
|
@@ -178,7 +178,7 @@ def summarize_results(student_name,
|
|
178 |
gr.update(visible=False, value=None), # rating_slider
|
179 |
gr.update(visible=False), # submit_feedback_button
|
180 |
gr.update(visible=False, value=""), # question_correct
|
181 |
-
gr.update(visible=False, value=""), #
|
182 |
gr.update(visible=False, value=""), # interesting_question
|
183 |
gr.update(visible=False), # rating_text
|
184 |
"", # feedback_questions_output
|
@@ -216,15 +216,17 @@ with gr.Blocks() as demo:
|
|
216 |
next_button = gr.Button("Наступне питання", visible=False)
|
217 |
|
218 |
feedback_questions_output = gr.Markdown(label="Пройдені питання")
|
219 |
-
feedback_not_provided = gr.Markdown("# Заповніть поля відгуку та залишіть оцінку!", visible=False)
|
220 |
-
question_correct_input = gr.Textbox(label="Чи коректно поставлено запитання і варіанти відповідей?",
|
221 |
-
visible=False)
|
222 |
-
text_coverage_input = gr.Textbox(label="Рівномірність покриття тексту", visible=False)
|
223 |
-
interesting_question_input = gr.Textbox(label="Цікавість запитань", visible=False)
|
224 |
-
feedback_input = gr.Textbox(label="Ваш відгук про тест", visible=False)
|
225 |
rating_text = gr.Markdown(
|
226 |
"### Шкала оцінювання:\n\n#### -2 — дуже погано\n\n#### -1 — погано\n\n#### 0 — задовільно\n\n#### 1 — добре\n\n#### 2 — відмінно",
|
227 |
visible=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
rating_buttons = gr.Radio([-2, -1, 0, 1, 2], label="Оцініть тест", visible=False, interactive=True)
|
229 |
submit_feedback_button = gr.Button("Завершити тест", visible=False)
|
230 |
|
@@ -241,7 +243,7 @@ with gr.Blocks() as demo:
|
|
241 |
gr.update(visible=False), # submit_feedback_button
|
242 |
gr.update(visible=False), # rating_text
|
243 |
gr.update(visible=False, value=""), # question_correct
|
244 |
-
gr.update(visible=False, value=""), #
|
245 |
gr.update(visible=False, value=""), # interesting_question
|
246 |
"", # feedback_questions_output
|
247 |
gr.update(visible=False), # feedback_not_provided
|
@@ -264,9 +266,9 @@ with gr.Blocks() as demo:
|
|
264 |
rating_buttons,
|
265 |
submit_feedback_button,
|
266 |
rating_text,
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
feedback_questions_output,
|
271 |
feedback_not_provided,
|
272 |
]
|
@@ -283,9 +285,9 @@ with gr.Blocks() as demo:
|
|
283 |
rating_buttons,
|
284 |
submit_feedback_button,
|
285 |
rating_text,
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
feedback_questions_output,
|
290 |
]
|
291 |
)
|
@@ -299,18 +301,18 @@ with gr.Blocks() as demo:
|
|
299 |
book_radio,
|
300 |
feedback_input,
|
301 |
rating_buttons,
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
],
|
306 |
outputs=[
|
307 |
question_output,
|
308 |
feedback_input,
|
309 |
rating_buttons,
|
310 |
submit_feedback_button,
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
rating_text,
|
315 |
feedback_questions_output,
|
316 |
feedback_not_provided,
|
|
|
68 |
gr.update(visible=False), # submit_feedback_button
|
69 |
gr.update(visible=False), # rating_text
|
70 |
gr.update(visible=False), # question_correct
|
71 |
+
gr.update(visible=False), # answers_correct
|
72 |
gr.update(visible=False), # interesting_question
|
73 |
"", # feedback_questions_output
|
74 |
)
|
|
|
93 |
gr.update(visible=False), # submit_feedback_button
|
94 |
gr.update(visible=False), # rating_text
|
95 |
gr.update(visible=False), # question_correct
|
96 |
+
gr.update(visible=False), # answers_correct
|
97 |
gr.update(visible=False), # interesting_question
|
98 |
"", # feedback_questions_output
|
99 |
)
|
|
|
110 |
gr.update(visible=True), # submit_feedback_button
|
111 |
gr.update(visible=True), # rating_text
|
112 |
gr.update(visible=True), # question_correct
|
113 |
+
gr.update(visible=True), # answers_correct
|
114 |
gr.update(visible=True), # interesting_question
|
115 |
feedback_questions, # feedback_questions_output
|
116 |
)
|
|
|
123 |
feedback,
|
124 |
rating,
|
125 |
question_correct,
|
126 |
+
answers_correct,
|
127 |
interesting_question):
|
128 |
global questions_data, answers_log, feedback_questions
|
129 |
questions = []
|
130 |
|
131 |
+
if not feedback or question_correct is None or answers_correct is None or interesting_question is None or rating is None:
|
132 |
return (
|
133 |
"# Залиште відгук про тест!", # question_output
|
134 |
gr.update(visible=True), # feedback_input
|
135 |
gr.update(visible=True), # rating_slider
|
136 |
gr.update(visible=True), # submit_feedback_button
|
137 |
gr.update(visible=True), # question_correct
|
138 |
+
gr.update(visible=True), # answers_correct
|
139 |
gr.update(visible=True), # interesting_question
|
140 |
gr.update(visible=True), # rating_text
|
141 |
feedback_questions, # feedback_questions_output
|
|
|
157 |
feedback,
|
158 |
rating,
|
159 |
question_correct,
|
160 |
+
answers_correct,
|
161 |
interesting_question
|
162 |
)
|
163 |
|
|
|
178 |
gr.update(visible=False, value=None), # rating_slider
|
179 |
gr.update(visible=False), # submit_feedback_button
|
180 |
gr.update(visible=False, value=""), # question_correct
|
181 |
+
gr.update(visible=False, value=""), # answers_correct
|
182 |
gr.update(visible=False, value=""), # interesting_question
|
183 |
gr.update(visible=False), # rating_text
|
184 |
"", # feedback_questions_output
|
|
|
216 |
next_button = gr.Button("Наступне питання", visible=False)
|
217 |
|
218 |
feedback_questions_output = gr.Markdown(label="Пройдені питання")
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
rating_text = gr.Markdown(
|
220 |
"### Шкала оцінювання:\n\n#### -2 — дуже погано\n\n#### -1 — погано\n\n#### 0 — задовільно\n\n#### 1 — добре\n\n#### 2 — відмінно",
|
221 |
visible=False)
|
222 |
+
feedback_not_provided = gr.Markdown("# Заповніть поля відгуку та залишіть оцінку!", visible=False)
|
223 |
+
question_correct_radio = gr.Radio([-2, -1, 0, 1, 2], label="Чи коректно поставлені запитання?", visible=False,
|
224 |
+
interactive=True)
|
225 |
+
answers_correct_radio = gr.Radio([-2, -1, 0, 1, 2], label="Чи коректно поставлені варіанти відповідей?",
|
226 |
+
visible=False, interactive=True)
|
227 |
+
interesting_question_radio = gr.Radio([-2, -1, 0, 1, 2], label="Чи цікаві були запитання?", visible=False,
|
228 |
+
interactive=True)
|
229 |
+
feedback_input = gr.Textbox(label="Будь-який коментар про тест (за бажанням)", visible=False)
|
230 |
rating_buttons = gr.Radio([-2, -1, 0, 1, 2], label="Оцініть тест", visible=False, interactive=True)
|
231 |
submit_feedback_button = gr.Button("Завершити тест", visible=False)
|
232 |
|
|
|
243 |
gr.update(visible=False), # submit_feedback_button
|
244 |
gr.update(visible=False), # rating_text
|
245 |
gr.update(visible=False, value=""), # question_correct
|
246 |
+
gr.update(visible=False, value=""), # answers_correct
|
247 |
gr.update(visible=False, value=""), # interesting_question
|
248 |
"", # feedback_questions_output
|
249 |
gr.update(visible=False), # feedback_not_provided
|
|
|
266 |
rating_buttons,
|
267 |
submit_feedback_button,
|
268 |
rating_text,
|
269 |
+
question_correct_radio,
|
270 |
+
answers_correct_radio,
|
271 |
+
interesting_question_radio,
|
272 |
feedback_questions_output,
|
273 |
feedback_not_provided,
|
274 |
]
|
|
|
285 |
rating_buttons,
|
286 |
submit_feedback_button,
|
287 |
rating_text,
|
288 |
+
question_correct_radio,
|
289 |
+
answers_correct_radio,
|
290 |
+
interesting_question_radio,
|
291 |
feedback_questions_output,
|
292 |
]
|
293 |
)
|
|
|
301 |
book_radio,
|
302 |
feedback_input,
|
303 |
rating_buttons,
|
304 |
+
question_correct_radio,
|
305 |
+
answers_correct_radio,
|
306 |
+
interesting_question_radio,
|
307 |
],
|
308 |
outputs=[
|
309 |
question_output,
|
310 |
feedback_input,
|
311 |
rating_buttons,
|
312 |
submit_feedback_button,
|
313 |
+
question_correct_radio,
|
314 |
+
answers_correct_radio,
|
315 |
+
interesting_question_radio,
|
316 |
rating_text,
|
317 |
feedback_questions_output,
|
318 |
feedback_not_provided,
|
utils/db.py
CHANGED
@@ -32,7 +32,7 @@ def save_results(student_name,
|
|
32 |
feedback,
|
33 |
rating,
|
34 |
question_correct,
|
35 |
-
|
36 |
interesting_question):
|
37 |
print("Saving results")
|
38 |
collection.insert_one({
|
@@ -42,7 +42,7 @@ def save_results(student_name,
|
|
42 |
"book": book,
|
43 |
"questions": questions,
|
44 |
"question_correct": question_correct,
|
45 |
-
"
|
46 |
"interesting_question": interesting_question,
|
47 |
"feedback": feedback,
|
48 |
"rating": rating,
|
|
|
32 |
feedback,
|
33 |
rating,
|
34 |
question_correct,
|
35 |
+
answers_correct,
|
36 |
interesting_question):
|
37 |
print("Saving results")
|
38 |
collection.insert_one({
|
|
|
42 |
"book": book,
|
43 |
"questions": questions,
|
44 |
"question_correct": question_correct,
|
45 |
+
"answers_correct": answers_correct,
|
46 |
"interesting_question": interesting_question,
|
47 |
"feedback": feedback,
|
48 |
"rating": rating,
|