Yoon-gu Hwang commited on
Commit
4272589
1 Parent(s): 8a477cd

다시 로드해도 기존 기록 보관하기

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -42,7 +42,8 @@ def get_question_answer(pokemons_set):
42
  initial_info = {"done" : True,
43
  "score": 0, "count": 0,
44
  "best_score": 0, "best_time": float("inf"),
45
- "time": 0.0, "comment": ""}
 
46
 
47
  try:
48
  folder = run.use_artifact("settings:latest").download()
@@ -177,12 +178,13 @@ with gr.Blocks() as demo:
177
  btn = gr.Button(value="퀴즈 시작", label="퀴즈 시작")
178
  else:
179
  btn = gr.Button(value="포기하기", label="퀴즈 중단")
 
180
  return btn, "", chat_history, md
181
 
182
  play.click(respond,
183
  inputs=[play, chatbot, user, quiz_count, generation, poke_types],
184
  outputs=[play, msg, chatbot, leader_board])
185
- skip.click(respond,
186
  inputs=[skip, chatbot, user, quiz_count, generation, poke_types],
187
  outputs=[play, msg, chatbot, leader_board])
188
 
@@ -207,10 +209,10 @@ with gr.Blocks() as demo:
207
  else:
208
  btn = gr.Button(value="포기하기", label="퀴즈 중단")
209
 
210
- return btn, md, gr.Dropdown(USERS, value=user, label="사용자", info="당신은 누구신가요?", allow_custom_value=True)
211
  demo.load(update_table,
212
  inputs=user,
213
- outputs=[play, leader_board, user])
214
  msg.submit(respond, [msg, chatbot, user, quiz_count, generation, poke_types], [play, msg, chatbot, leader_board])
215
 
216
  demo.queue(concurrency_count=1)
 
42
  initial_info = {"done" : True,
43
  "score": 0, "count": 0,
44
  "best_score": 0, "best_time": float("inf"),
45
+ "time": 0.0, "comment": "",
46
+ "history": []}
47
 
48
  try:
49
  folder = run.use_artifact("settings:latest").download()
 
178
  btn = gr.Button(value="퀴즈 시작", label="퀴즈 시작")
179
  else:
180
  btn = gr.Button(value="포기하기", label="퀴즈 중단")
181
+ info[user]['history'] = chat_history
182
  return btn, "", chat_history, md
183
 
184
  play.click(respond,
185
  inputs=[play, chatbot, user, quiz_count, generation, poke_types],
186
  outputs=[play, msg, chatbot, leader_board])
187
+ skip.click(respond,
188
  inputs=[skip, chatbot, user, quiz_count, generation, poke_types],
189
  outputs=[play, msg, chatbot, leader_board])
190
 
 
209
  else:
210
  btn = gr.Button(value="포기하기", label="퀴즈 중단")
211
 
212
+ return btn, md, gr.Dropdown(USERS, value=user, label="사용자", info="당신은 누구신가요?", allow_custom_value=True), info[user]['history']
213
  demo.load(update_table,
214
  inputs=user,
215
+ outputs=[play, leader_board, user, chatbot])
216
  msg.submit(respond, [msg, chatbot, user, quiz_count, generation, poke_types], [play, msg, chatbot, leader_board])
217
 
218
  demo.queue(concurrency_count=1)