Update app.py
Browse files
app.py
CHANGED
@@ -39,6 +39,11 @@ def get_question_answer(pokemons_set):
|
|
39 |
info = {u: {"done" : True, "score": 0, "count": 0, "best_score": 0, "best_time": float("inf"), "time": 0.0} for u in USERS}
|
40 |
|
41 |
MD = """# ํฌ์ผ๋ชฌ ํด์ฆ
|
|
|
|
|
|
|
|
|
|
|
42 |
## ์ฌ์ฉ๋ฐฉ๋ฒ
|
43 |
|
44 |
1. ์ฌ์ฉ์๋ฅผ ์ ํํ์ธ์.
|
@@ -72,6 +77,7 @@ with gr.Blocks() as demo:
|
|
72 |
)
|
73 |
with gr.Row():
|
74 |
play = gr.Button(value="ํด์ฆ ์์", label="ํด์ฆ ์์")
|
|
|
75 |
stop = gr.Button(value="ํด์ฆ ์ข
๋ฃ", label="ํด์ฆ ์ข
๋ฃ")
|
76 |
chatbot = gr.Chatbot(bubble_full_width=False,
|
77 |
avatar_images=["https://huggingface.co/spaces/yoon-gu/pokemon/resolve/main/images/No_0001_์ด์ํด์จ.png",
|
@@ -112,6 +118,11 @@ with gr.Blocks() as demo:
|
|
112 |
elif "ํด์ฆ์ข
๋ฃ" == message.replace(" ", ""):
|
113 |
bot_message = f"ํด์ฆ๋ฅผ ๊ฐ์ ์ข
๋ฃํฉ๋๋ค."
|
114 |
info[user]['done'] = True
|
|
|
|
|
|
|
|
|
|
|
115 |
else:
|
116 |
hint1 = ""
|
117 |
for i, y in enumerate(answer.value):
|
@@ -131,6 +142,9 @@ with gr.Blocks() as demo:
|
|
131 |
play.click(respond,
|
132 |
inputs=[play, chatbot, user, quiz_count, generation, poke_types],
|
133 |
outputs=[msg, chatbot, markdown])
|
|
|
|
|
|
|
134 |
stop.click(respond,
|
135 |
inputs=[stop, chatbot, user, quiz_count, generation, poke_types],
|
136 |
outputs=[msg, chatbot, markdown])
|
|
|
39 |
info = {u: {"done" : True, "score": 0, "count": 0, "best_score": 0, "best_time": float("inf"), "time": 0.0} for u in USERS}
|
40 |
|
41 |
MD = """# ํฌ์ผ๋ชฌ ํด์ฆ
|
42 |
+
## ๊ณต๋ถ ๋ฐฉ๋ฒ
|
43 |
+
|
44 |
+
์๋ ํฌ์ผ๋ชฌ ๋๊ฐ์ ๋ณด๊ณ ๊ณต๋ถํ๋ฉด ๋์์ด ๋ฉ๋๋ค.
|
45 |
+
- https://huggingface.co/spaces/yoon-gu/pokemon
|
46 |
+
|
47 |
## ์ฌ์ฉ๋ฐฉ๋ฒ
|
48 |
|
49 |
1. ์ฌ์ฉ์๋ฅผ ์ ํํ์ธ์.
|
|
|
77 |
)
|
78 |
with gr.Row():
|
79 |
play = gr.Button(value="ํด์ฆ ์์", label="ํด์ฆ ์์")
|
80 |
+
skip = gr.Button(value="๋ฌธ์ ๋์ด๊ฐ๊ธฐ", label="๋ฌธ์ ์คํต")
|
81 |
stop = gr.Button(value="ํด์ฆ ์ข
๋ฃ", label="ํด์ฆ ์ข
๋ฃ")
|
82 |
chatbot = gr.Chatbot(bubble_full_width=False,
|
83 |
avatar_images=["https://huggingface.co/spaces/yoon-gu/pokemon/resolve/main/images/No_0001_์ด์ํด์จ.png",
|
|
|
118 |
elif "ํด์ฆ์ข
๋ฃ" == message.replace(" ", ""):
|
119 |
bot_message = f"ํด์ฆ๋ฅผ ๊ฐ์ ์ข
๋ฃํฉ๋๋ค."
|
120 |
info[user]['done'] = True
|
121 |
+
elif "๋ฌธ์ ๋์ด๊ฐ๊ธฐ" == message:
|
122 |
+
info[user]['count'] += 1
|
123 |
+
q, a = get_question_answer(pokemons_set)
|
124 |
+
answer.value = a
|
125 |
+
bot_message = f"๋ฌธ์ ๋ฅผ ๋์ด๊ฐ๋๋ค. ๋ค์๋ฌธ์ ์
๋๋ค.\n{q}"
|
126 |
else:
|
127 |
hint1 = ""
|
128 |
for i, y in enumerate(answer.value):
|
|
|
142 |
play.click(respond,
|
143 |
inputs=[play, chatbot, user, quiz_count, generation, poke_types],
|
144 |
outputs=[msg, chatbot, markdown])
|
145 |
+
stop.click(respond,
|
146 |
+
inputs=[skip, chatbot, user, quiz_count, generation, poke_types],
|
147 |
+
outputs=[msg, chatbot, markdown])
|
148 |
stop.click(respond,
|
149 |
inputs=[stop, chatbot, user, quiz_count, generation, poke_types],
|
150 |
outputs=[msg, chatbot, markdown])
|