mkw18 commited on
Commit
33c4d36
1 Parent(s): 49a6990
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -268,7 +268,7 @@ def zh_en_trans(zh):
268
  return chatbot, messages, gr.update(value=""), gr.update(value="显示答案") if zh else gr.update(value="Show Answer"), answer, idx, gr.update(value=data['story'].strip()), False, story_key, answer_key, [], 0, [], [], zh, gr.update(value="English") if zh else gr.update(value="中文"), gr.update(value="发送") if zh else gr.update(value="Submit"), gr.update(value="再来一局") if zh else gr.update(value="New Game"), gr.update(value="海龟汤是一个推理类游戏,游戏开始时会给出一段隐去关键信息的叙述,即汤面,玩家根据汤面推理,提出能够通过“是”或“否”来回答的问题,通过提问不同可能性,缩小真相的范围,直到最终猜到真相(即汤底)的关键信息。玩家可以点击“再来一局”按钮随机一场新的游戏,点击“显示答案”可查看汤底。") if zh else gr.update(value="Lateral Thinking Puzzle is a deductive reasoning game. At the beginning of the game, players receive a narrative with key information concealed, referred to as the \"story\". Based on the story, players deduce and ask questions that can be answered with \"yes\" or \"no\" to narrow down different possibilities and ultimately guess the key information, known as the \"truth\". Players can click the \"New Game\" button to start a new random game or click the \"Show Answer\" button to reveal the truth.")
269
 
270
 
271
- def show_hide_answer(answer, show_ans):
272
  if show_ans:
273
  show_ans = False
274
  return gr.update(value=""), gr.update(value="显示答案") if zh else gr.update(value="Show Answer"), show_ans
@@ -293,7 +293,7 @@ with gr.Blocks() as demo:
293
  answer = gr.State('Click the \"New Game\" button to get started.')
294
  idx = gr.State(0)
295
  show_ans = gr.State(False)
296
- zh = gr.State(True)
297
  known = gr.State([])
298
  story_key = gr.State([])
299
  answer_key = gr.State([])
@@ -327,6 +327,6 @@ with gr.Blocks() as demo:
327
 
328
  emptyBtn.click(reset_state, [zh], [chatbot, messages, answer_output, answerBtn, answer, idx, question, show_ans, story_key, answer_key, known, bingo, reasoning, history, zh], show_progress=True)
329
 
330
- answerBtn.click(show_hide_answer, [answer, show_ans], outputs=[answer_output, answerBtn, show_ans], show_progress=True)
331
 
332
  demo.queue().launch()
 
268
  return chatbot, messages, gr.update(value=""), gr.update(value="显示答案") if zh else gr.update(value="Show Answer"), answer, idx, gr.update(value=data['story'].strip()), False, story_key, answer_key, [], 0, [], [], zh, gr.update(value="English") if zh else gr.update(value="中文"), gr.update(value="发送") if zh else gr.update(value="Submit"), gr.update(value="再来一局") if zh else gr.update(value="New Game"), gr.update(value="海龟汤是一个推理类游戏,游戏开始时会给出一段隐去关键信息的叙述,即汤面,玩家根据汤面推理,提出能够通过“是”或“否”来回答的问题,通过提问不同可能性,缩小真相的范围,直到最终猜到真相(即汤底)的关键信息。玩家可以点击“再来一局”按钮随机一场新的游戏,点击“显示答案”可查看汤底。") if zh else gr.update(value="Lateral Thinking Puzzle is a deductive reasoning game. At the beginning of the game, players receive a narrative with key information concealed, referred to as the \"story\". Based on the story, players deduce and ask questions that can be answered with \"yes\" or \"no\" to narrow down different possibilities and ultimately guess the key information, known as the \"truth\". Players can click the \"New Game\" button to start a new random game or click the \"Show Answer\" button to reveal the truth.")
269
 
270
 
271
+ def show_hide_answer(answer, show_ans, zh):
272
  if show_ans:
273
  show_ans = False
274
  return gr.update(value=""), gr.update(value="显示答案") if zh else gr.update(value="Show Answer"), show_ans
 
293
  answer = gr.State('Click the \"New Game\" button to get started.')
294
  idx = gr.State(0)
295
  show_ans = gr.State(False)
296
+ zh = gr.State(False)
297
  known = gr.State([])
298
  story_key = gr.State([])
299
  answer_key = gr.State([])
 
327
 
328
  emptyBtn.click(reset_state, [zh], [chatbot, messages, answer_output, answerBtn, answer, idx, question, show_ans, story_key, answer_key, known, bingo, reasoning, history, zh], show_progress=True)
329
 
330
+ answerBtn.click(show_hide_answer, [answer, show_ans, zh], outputs=[answer_output, answerBtn, show_ans], show_progress=True)
331
 
332
  demo.queue().launch()