Spaces:
Runtime error
Runtime error
Merge branch 'main' of https://github.com/opendilab/LLMRiddles
Browse files
app.py
CHANGED
@@ -28,6 +28,7 @@ if _LANG == "cn":
|
|
28 |
correct_label = "正确"
|
29 |
wrong_label = "错误"
|
30 |
api_error_info = "请在提交问题之前先输入你的 API Key"
|
|
|
31 |
elif _LANG == "en":
|
32 |
requirement_ph = 'Click \'Next\' to Start'
|
33 |
requirement_label = "Requirements"
|
@@ -45,6 +46,7 @@ elif _LANG == "en":
|
|
45 |
correct_label = "Correct"
|
46 |
wrong_label = "Wrong"
|
47 |
api_error_info = "Please Enter API Key Before Submitting Question."
|
|
|
48 |
else:
|
49 |
raise KeyError("invalid _LANG: {}".format(_LANG))
|
50 |
|
@@ -72,7 +74,7 @@ if __name__ == '__main__':
|
|
72 |
with gr.Column():
|
73 |
gr_api_key = gr.Text(placeholder=api_ph, label=api_label, type='password',
|
74 |
visible=_need_api_key())
|
75 |
-
gr_uuid = gr.Text(value='')
|
76 |
gr_predict = gr.Label(label=predict_label)
|
77 |
gr_explanation = gr.TextArea(label=explanation_label)
|
78 |
gr_next = gr.Button(next_label)
|
@@ -87,9 +89,11 @@ if __name__ == '__main__':
|
|
87 |
_QUESTION_IDS[uuid_] = _qid
|
88 |
|
89 |
if _qid >= len(_QUESTIONS):
|
|
|
90 |
return game_cleared_label, '', '', {}, '', \
|
91 |
gr.Button(submit_label, interactive=False), \
|
92 |
-
gr.Button(
|
|
|
93 |
else:
|
94 |
executor = QuestionExecutor(_QUESTIONS[_qid], _LANG)
|
95 |
return executor.question_text, '', '', {}, '', \
|
|
|
28 |
correct_label = "正确"
|
29 |
wrong_label = "错误"
|
30 |
api_error_info = "请在提交问题之前先输入你的 API Key"
|
31 |
+
try_again_label = "再玩一次"
|
32 |
elif _LANG == "en":
|
33 |
requirement_ph = 'Click \'Next\' to Start'
|
34 |
requirement_label = "Requirements"
|
|
|
46 |
correct_label = "Correct"
|
47 |
wrong_label = "Wrong"
|
48 |
api_error_info = "Please Enter API Key Before Submitting Question."
|
49 |
+
try_again_label = "Try Again"
|
50 |
else:
|
51 |
raise KeyError("invalid _LANG: {}".format(_LANG))
|
52 |
|
|
|
74 |
with gr.Column():
|
75 |
gr_api_key = gr.Text(placeholder=api_ph, label=api_label, type='password',
|
76 |
visible=_need_api_key())
|
77 |
+
gr_uuid = gr.Text(value='', visible=False)
|
78 |
gr_predict = gr.Label(label=predict_label)
|
79 |
gr_explanation = gr.TextArea(label=explanation_label)
|
80 |
gr_next = gr.Button(next_label)
|
|
|
89 |
_QUESTION_IDS[uuid_] = _qid
|
90 |
|
91 |
if _qid >= len(_QUESTIONS):
|
92 |
+
del _QUESTION_IDS[uuid_]
|
93 |
return game_cleared_label, '', '', {}, '', \
|
94 |
gr.Button(submit_label, interactive=False), \
|
95 |
+
gr.Button(try_again_label, interactive=True), \
|
96 |
+
''
|
97 |
else:
|
98 |
executor = QuestionExecutor(_QUESTIONS[_qid], _LANG)
|
99 |
return executor.question_text, '', '', {}, '', \
|