vladyslav
commited on
Commit
·
834de25
1
Parent(s):
0c7274f
Make -2 to 2 rating scale
Browse files
app.py
CHANGED
@@ -65,6 +65,7 @@ def get_next_question(selected_answer):
|
|
65 |
gr.update(visible=False), # feedback_input
|
66 |
gr.update(visible=False), # rating_slider
|
67 |
gr.update(visible=False), # submit_feedback_button
|
|
|
68 |
)
|
69 |
|
70 |
# Writing answer in log
|
@@ -85,6 +86,7 @@ def get_next_question(selected_answer):
|
|
85 |
gr.update(visible=False), # feedback_input
|
86 |
gr.update(visible=False), # rating_slider
|
87 |
gr.update(visible=False), # submit_feedback_button
|
|
|
88 |
)
|
89 |
else:
|
90 |
# All questions are completed — ask for feedback
|
@@ -96,6 +98,7 @@ def get_next_question(selected_answer):
|
|
96 |
gr.update(visible=True), # feedback_input
|
97 |
gr.update(visible=True), # rating_slider
|
98 |
gr.update(visible=True), # submit_feedback_button
|
|
|
99 |
)
|
100 |
|
101 |
|
@@ -153,7 +156,8 @@ with gr.Blocks() as demo:
|
|
153 |
next_button = gr.Button("Наступне питання", visible=False)
|
154 |
|
155 |
feedback_input = gr.Textbox(label="Ваш відгук про тест", visible=False)
|
156 |
-
|
|
|
157 |
submit_feedback_button = gr.Button("Завершити тест", visible=False)
|
158 |
|
159 |
|
@@ -173,19 +177,19 @@ with gr.Blocks() as demo:
|
|
173 |
load_button.click(
|
174 |
update_question,
|
175 |
inputs=[model_radio, book_radio, student_name_input, class_name_input],
|
176 |
-
outputs=[question_output, answer_radio, next_button, feedback_input,
|
177 |
)
|
178 |
|
179 |
next_button.click(
|
180 |
get_next_question,
|
181 |
inputs=[answer_radio],
|
182 |
-
outputs=[question_output, answer_radio, next_button, feedback_input,
|
183 |
)
|
184 |
|
185 |
submit_feedback_button.click(
|
186 |
summarize_results,
|
187 |
-
inputs=[student_name_input, class_name_input, model_radio, book_radio, feedback_input,
|
188 |
-
outputs=[question_output, feedback_input,
|
189 |
)
|
190 |
|
191 |
if __name__ == "__main__":
|
|
|
65 |
gr.update(visible=False), # feedback_input
|
66 |
gr.update(visible=False), # rating_slider
|
67 |
gr.update(visible=False), # submit_feedback_button
|
68 |
+
gr.update(visible=False), # rating_text
|
69 |
)
|
70 |
|
71 |
# Writing answer in log
|
|
|
86 |
gr.update(visible=False), # feedback_input
|
87 |
gr.update(visible=False), # rating_slider
|
88 |
gr.update(visible=False), # submit_feedback_button
|
89 |
+
gr.update(visible=False), # rating_text
|
90 |
)
|
91 |
else:
|
92 |
# All questions are completed — ask for feedback
|
|
|
98 |
gr.update(visible=True), # feedback_input
|
99 |
gr.update(visible=True), # rating_slider
|
100 |
gr.update(visible=True), # submit_feedback_button
|
101 |
+
gr.update(visible=True), # rating_text
|
102 |
)
|
103 |
|
104 |
|
|
|
156 |
next_button = gr.Button("Наступне питання", visible=False)
|
157 |
|
158 |
feedback_input = gr.Textbox(label="Ваш відгук про тест", visible=False)
|
159 |
+
rating_text = gr.Markdown("### Шкала оцінювання:\n\n#### -2 — дуже погано\n\n#### -1 — погано\n\n#### 0 — задовільно\n\n#### 1 — добре\n\n#### 2 — відмінно", visible=False)
|
160 |
+
rating_buttons = gr.Radio([-2, -1, 0, 1, 2], label="Оцініть тест", visible=False, interactive=True)
|
161 |
submit_feedback_button = gr.Button("Завершити тест", visible=False)
|
162 |
|
163 |
|
|
|
177 |
load_button.click(
|
178 |
update_question,
|
179 |
inputs=[model_radio, book_radio, student_name_input, class_name_input],
|
180 |
+
outputs=[question_output, answer_radio, next_button, feedback_input, rating_buttons, submit_feedback_button]
|
181 |
)
|
182 |
|
183 |
next_button.click(
|
184 |
get_next_question,
|
185 |
inputs=[answer_radio],
|
186 |
+
outputs=[question_output, answer_radio, next_button, feedback_input, rating_buttons, submit_feedback_button, rating_text]
|
187 |
)
|
188 |
|
189 |
submit_feedback_button.click(
|
190 |
summarize_results,
|
191 |
+
inputs=[student_name_input, class_name_input, model_radio, book_radio, feedback_input, rating_buttons],
|
192 |
+
outputs=[question_output, feedback_input, rating_buttons, submit_feedback_button]
|
193 |
)
|
194 |
|
195 |
if __name__ == "__main__":
|