Rooni commited on
Commit
cd0e092
·
1 Parent(s): 18f884f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -1,7 +1,14 @@
1
  import gradio as gr
2
 
 
 
 
3
  # functions
4
  def check(answers, correct_answers):
 
 
 
 
5
  if not all(answers):
6
  raise gr.Error("Выберите все ответы!")
7
 
@@ -10,6 +17,7 @@ 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
 
1
  import gradio as gr
2
 
3
+ # Global variable to track if the check has been done
4
+ check_done = False
5
+
6
  # functions
7
  def check(answers, correct_answers):
8
+ global check_done
9
+ if check_done:
10
+ raise gr.Error("Вы уже проверили ответы!")
11
+
12
  if not all(answers):
13
  raise gr.Error("Выберите все ответы!")
14
 
 
17
  result = "✔" if answer == correct_answer else "✖️"
18
  results.append(f"{i}: {result}")
19
 
20
+ check_done = True # Set the flag to True after the check
21
  return "\n".join(results)
22
 
23
  # css