gardarjuto
commited on
Commit
•
e568e74
1
Parent(s):
3ad2259
Improved description and title
Browse files
app.py
CHANGED
@@ -6,7 +6,6 @@ from quiz import BenchmarkQuiz, BENCHMARKS, QuestionData
|
|
6 |
mpl.rcParams["figure.dpi"] = 300
|
7 |
|
8 |
|
9 |
-
|
10 |
def update_quiz_screen(quiz: BenchmarkQuiz, question_data: QuestionData):
|
11 |
quiz_state = quiz.state
|
12 |
return {
|
@@ -48,7 +47,13 @@ def update_score_screen(plot, results_data):
|
|
48 |
else "incorrect-answer"
|
49 |
],
|
50 |
)
|
51 |
-
emoji =
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
markdown_string = f"### {emoji} Spurning {result['question_num']}"
|
54 |
markdown_string += f"\n{result['question']}"
|
@@ -95,7 +100,6 @@ def next_question_handler(quiz, answer_input, free_text_input):
|
|
95 |
return {**update_quiz_screen(quiz, result["question_data"]), quiz_state: quiz}
|
96 |
|
97 |
|
98 |
-
|
99 |
def previous_question_handler(quiz):
|
100 |
question_data = quiz.previous_question()
|
101 |
return {**update_quiz_screen(quiz, question_data), quiz_state: quiz}
|
@@ -137,7 +141,11 @@ demo = gr.Blocks(
|
|
137 |
with demo:
|
138 |
start_screen = gr.Column(visible=True)
|
139 |
with start_screen:
|
140 |
-
gr.Markdown("#
|
|
|
|
|
|
|
|
|
141 |
benchmark_buttons = {
|
142 |
name: gr.Button(info["name"]) for name, info in BENCHMARKS.items()
|
143 |
}
|
@@ -163,7 +171,7 @@ with demo:
|
|
163 |
for card in result_cards:
|
164 |
with card:
|
165 |
gr.Markdown("")
|
166 |
-
|
167 |
quiz_state = gr.State()
|
168 |
|
169 |
for benchmark_name, button in benchmark_buttons.items():
|
|
|
6 |
mpl.rcParams["figure.dpi"] = 300
|
7 |
|
8 |
|
|
|
9 |
def update_quiz_screen(quiz: BenchmarkQuiz, question_data: QuestionData):
|
10 |
quiz_state = quiz.state
|
11 |
return {
|
|
|
47 |
else "incorrect-answer"
|
48 |
],
|
49 |
)
|
50 |
+
emoji = (
|
51 |
+
"✅"
|
52 |
+
if result["points"] == 1.0
|
53 |
+
else "❌"
|
54 |
+
if result["points"] == 0.0
|
55 |
+
else "🔶"
|
56 |
+
)
|
57 |
|
58 |
markdown_string = f"### {emoji} Spurning {result['question_num']}"
|
59 |
markdown_string += f"\n{result['question']}"
|
|
|
100 |
return {**update_quiz_screen(quiz, result["question_data"]), quiz_state: quiz}
|
101 |
|
102 |
|
|
|
103 |
def previous_question_handler(quiz):
|
104 |
question_data = quiz.previous_question()
|
105 |
return {**update_quiz_screen(quiz, question_data), quiz_state: quiz}
|
|
|
141 |
with demo:
|
142 |
start_screen = gr.Column(visible=True)
|
143 |
with start_screen:
|
144 |
+
gr.Markdown("# Kepptu við risamállíkönin!")
|
145 |
+
gr.Markdown(
|
146 |
+
"Veldu þér einn af flokkunum að neðan og þreyttu stutta útgáfu af prófi sem við leggjum fyrir risamállíkönin. "
|
147 |
+
"Eftir að þú hefur lokið prófinu færðu að sjá hvar þú stendur miðað við líkönin."
|
148 |
+
)
|
149 |
benchmark_buttons = {
|
150 |
name: gr.Button(info["name"]) for name, info in BENCHMARKS.items()
|
151 |
}
|
|
|
171 |
for card in result_cards:
|
172 |
with card:
|
173 |
gr.Markdown("")
|
174 |
+
|
175 |
quiz_state = gr.State()
|
176 |
|
177 |
for benchmark_name, button in benchmark_buttons.items():
|