Spaces:
Running
Running
add icon & more hints
Browse files
app.py
CHANGED
@@ -16,6 +16,7 @@ invalid = ["yi", "ye", "wi", "wu", "we"]
|
|
16 |
|
17 |
def next_question(hira, kata, c, quiz_list):
|
18 |
if not quiz_list:
|
|
|
19 |
quiz_list = init_question(hira, kata, c)
|
20 |
return quiz_list.pop(), quiz_list
|
21 |
|
@@ -45,6 +46,7 @@ def init_question(hira, kata, c):
|
|
45 |
def is_valid(aa: str, bb: str):
|
46 |
if f"{aa}{bb}" in invalid:
|
47 |
return False
|
|
|
48 |
if aa == "y":
|
49 |
if bb[0] == "y":
|
50 |
return False
|
@@ -52,6 +54,7 @@ def is_valid(aa: str, bb: str):
|
|
52 |
return False
|
53 |
if bb == "":
|
54 |
return False
|
|
|
55 |
return True
|
56 |
|
57 |
|
@@ -97,7 +100,8 @@ with gr.Blocks(theme=theme, title="假名小測驗") as app:
|
|
97 |
with gr.Column():
|
98 |
with gr.Tab("測驗"):
|
99 |
with gr.Row():
|
100 |
-
|
|
|
101 |
score = gr.Textbox("0/0", label="分數")
|
102 |
answer = gr.Textbox(label="作答")
|
103 |
|
@@ -125,4 +129,4 @@ with gr.Blocks(theme=theme, title="假名小測驗") as app:
|
|
125 |
answer.submit(**chk_arg).then(**nq_arg)
|
126 |
apply_btn.click(**ini_arg).then(**reset_arg).then(**nq_arg)
|
127 |
|
128 |
-
app.launch()
|
|
|
16 |
|
17 |
def next_question(hira, kata, c, quiz_list):
|
18 |
if not quiz_list:
|
19 |
+
gr.Info("已完成一輪測試!")
|
20 |
quiz_list = init_question(hira, kata, c)
|
21 |
return quiz_list.pop(), quiz_list
|
22 |
|
|
|
46 |
def is_valid(aa: str, bb: str):
|
47 |
if f"{aa}{bb}" in invalid:
|
48 |
return False
|
49 |
+
|
50 |
if aa == "y":
|
51 |
if bb[0] == "y":
|
52 |
return False
|
|
|
54 |
return False
|
55 |
if bb == "":
|
56 |
return False
|
57 |
+
|
58 |
return True
|
59 |
|
60 |
|
|
|
100 |
with gr.Column():
|
101 |
with gr.Tab("測驗"):
|
102 |
with gr.Row():
|
103 |
+
desc = "完成設定後按下「開始測驗」"
|
104 |
+
question = gr.Textbox(placeholder=desc, label="題目", interactive=False)
|
105 |
score = gr.Textbox("0/0", label="分數")
|
106 |
answer = gr.Textbox(label="作答")
|
107 |
|
|
|
129 |
answer.submit(**chk_arg).then(**nq_arg)
|
130 |
apply_btn.click(**ini_arg).then(**reset_arg).then(**nq_arg)
|
131 |
|
132 |
+
app.launch(favicon_path="icon.png")
|
icon.png
ADDED
![]() |