Spaces:
Runtime error
Runtime error
dev(hansbug): fix a bug
Browse files
app.py
CHANGED
@@ -6,7 +6,6 @@ import gradio as gr
|
|
6 |
from llmriddles.questions import QuestionExecutor
|
7 |
from llmriddles.questions import list_ordered_questions
|
8 |
|
9 |
-
_QUESTION_ID = -1
|
10 |
_QUESTION_IDS = {}
|
11 |
_QUESTIONS = list_ordered_questions()
|
12 |
_LANG = os.environ.get('QUESTION_LANG', 'cn')
|
@@ -51,13 +50,13 @@ if __name__ == '__main__':
|
|
51 |
_QUESTION_IDS[uuid_] = _qid
|
52 |
print(_QUESTION_IDS)
|
53 |
|
54 |
-
if
|
55 |
return 'Congratulations!', '', '', {}, '', \
|
56 |
gr.Button('Submit', interactive=False), \
|
57 |
gr.Button('Next', interactive=False), \
|
58 |
uuid_
|
59 |
else:
|
60 |
-
executor = QuestionExecutor(_QUESTIONS[
|
61 |
return executor.question_text, '', '', {}, '', \
|
62 |
gr.Button('Submit', interactive=True), \
|
63 |
gr.Button('Next', interactive=False), \
|
|
|
6 |
from llmriddles.questions import QuestionExecutor
|
7 |
from llmriddles.questions import list_ordered_questions
|
8 |
|
|
|
9 |
_QUESTION_IDS = {}
|
10 |
_QUESTIONS = list_ordered_questions()
|
11 |
_LANG = os.environ.get('QUESTION_LANG', 'cn')
|
|
|
50 |
_QUESTION_IDS[uuid_] = _qid
|
51 |
print(_QUESTION_IDS)
|
52 |
|
53 |
+
if _qid >= len(_QUESTIONS):
|
54 |
return 'Congratulations!', '', '', {}, '', \
|
55 |
gr.Button('Submit', interactive=False), \
|
56 |
gr.Button('Next', interactive=False), \
|
57 |
uuid_
|
58 |
else:
|
59 |
+
executor = QuestionExecutor(_QUESTIONS[_qid], _LANG)
|
60 |
return executor.question_text, '', '', {}, '', \
|
61 |
gr.Button('Submit', interactive=True), \
|
62 |
gr.Button('Next', interactive=False), \
|