Update app.py
Browse files
app.py
CHANGED
@@ -10,17 +10,15 @@ def check(answers, correct_answers):
|
|
10 |
result = "✔" if answer == correct_answer else "✖️"
|
11 |
results.append(f"{i}: {result}")
|
12 |
|
13 |
-
return "\n".join(results)
|
14 |
|
15 |
# css
|
16 |
css = """
|
17 |
footer {visibility: hidden !important;}
|
18 |
-
button, .output-container {transition: opacity 1s ease-in-out;}
|
19 |
-
button.hide, .output-container.hide {opacity: 0; pointer-events: none; height: 0; overflow: hidden;}
|
20 |
"""
|
21 |
|
22 |
# ui
|
23 |
-
with gr.Blocks(css=css) as vui:
|
24 |
question_blocks = []
|
25 |
correct_answers = ["А", "Б"] # Предполагаем, что это правильные ответы
|
26 |
for i, correct_answer in enumerate(correct_answers, start=1):
|
@@ -31,13 +29,12 @@ with gr.Blocks(css=css) as vui:
|
|
31 |
|
32 |
text_button = gr.Button("Проверить", variant='primary')
|
33 |
with gr.Tab("Результаты"):
|
34 |
-
text_output = gr.Markdown(
|
35 |
-
text_output_container = gr.HTML("") # Добавляем пустой HTML-контейнер для управления видимостью
|
36 |
|
37 |
def on_click(*args):
|
38 |
return check(args, correct_answers)
|
39 |
|
40 |
-
text_button.click(on_click, inputs=question_blocks, outputs=[text_output,
|
41 |
|
42 |
#end
|
43 |
vui.queue(api_open=False).launch()
|
|
|
10 |
result = "✔" if answer == correct_answer else "✖️"
|
11 |
results.append(f"{i}: {result}")
|
12 |
|
13 |
+
return "\n".join(results)
|
14 |
|
15 |
# css
|
16 |
css = """
|
17 |
footer {visibility: hidden !important;}
|
|
|
|
|
18 |
"""
|
19 |
|
20 |
# ui
|
21 |
+
with gr.Blocks(css=css, theme='YTheme/TehnoX') as vui:
|
22 |
question_blocks = []
|
23 |
correct_answers = ["А", "Б"] # Предполагаем, что это правильные ответы
|
24 |
for i, correct_answer in enumerate(correct_answers, start=1):
|
|
|
29 |
|
30 |
text_button = gr.Button("Проверить", variant='primary')
|
31 |
with gr.Tab("Результаты"):
|
32 |
+
text_output = gr.Markdown("")
|
|
|
33 |
|
34 |
def on_click(*args):
|
35 |
return check(args, correct_answers)
|
36 |
|
37 |
+
text_button.click(on_click, inputs=question_blocks, outputs=[text_output], queue=False)
|
38 |
|
39 |
#end
|
40 |
vui.queue(api_open=False).launch()
|