Spaces:
Runtime error
Runtime error
niuyazhe commited on
Commit ·
09b80dc
1
Parent(s): 7b6f638
fix(nyz): fix level4 bug and add naive counter
Browse filesFiles changed (2)
123451 unmodified line7891011121314151617181920113 unmodified lines1341351361371381391401411 unmodified line143144145146147148import osimport uuidimport gradio as gr1 unmodified linefrom llmriddles.questions import list_ordered_questions_QUESTION_IDS = {}_QUESTIONS = list_ordered_questions()_LANG = os.environ.get('QUESTION_LANG', 'cn')assert _LANG in ['cn', 'en'], _LANG_LLM = os.environ.get('QUESTION_LLM', 'chatgpt')assert _LLM in ['chatgpt', 'mistral-7b'], _LLM_LLM_KEY = os.environ.get('QUESTION_LLM_KEY', None)if _LANG == "cn":title = "完蛋!我被 LLM 拿捏了"requirement_ph = """欢迎来到 LLM Riddles!113 unmodified linesdef _next_question(uuid_):if not uuid_:uuid_ = str(uuid.uuid4())global _QUESTION_IDS_qid = _QUESTION_IDS.get(uuid_, -1)_qid += 11 unmodified lineif _qid >= len(_QUESTIONS):del _QUESTION_IDS[uuid_]return game_cleared_label, '', '', {}, '', \gr.Button(submit_label, interactive=False), \gr.Button(try_again_label, interactive=True), \1234561 unmodified line89101112131415161718192021222324252627113 unmodified lines1411421431441451461471481491501511 unmodified line153154155156157158159import osimport uuidimport loggingimport gradio as gr1 unmodified linefrom llmriddles.questions import list_ordered_questions_QUESTION_IDS = {}count = 0_QUESTIONS = list_ordered_questions()_LANG = os.environ.get('QUESTION_LANG', 'cn')assert _LANG in ['cn', 'en'], _LANG_LLM = os.environ.get('QUESTION_LLM', 'chatgpt')assert _LLM in ['chatgpt', 'mistral-7b'], _LLM_LLM_KEY = os.environ.get('QUESTION_LLM_KEY', None)_DEBUG = os.environ.get('DEBUG', 'false').lower() == 'true'if _LANG == "cn":if _DEBUG:logging.getLogger().setLevel(logging.INFO)else:logging.getLogger().setLevel(logging.WARNING)title = "完蛋!我被 LLM 拿捏了"requirement_ph = """欢迎来到 LLM Riddles!113 unmodified linesdef _next_question(uuid_):global countif not uuid_:uuid_ = str(uuid.uuid4())count += 1logging.info(f'Player {count} starts the game now')global _QUESTION_IDS_qid = _QUESTION_IDS.get(uuid_, -1)_qid += 11 unmodified lineif _qid >= len(_QUESTIONS):del _QUESTION_IDS[uuid_]logging.info(f'Player {count} has passed the game now')return game_cleared_label, '', '', {}, '', \gr.Button(submit_label, interactive=False), \gr.Button(try_again_label, interactive=True), \
64 unmodified lines6566676869707164 unmodified linesCN_TEXT_3 = """第四章第三题,请在下面的输入框内填写你构造并点击按钮提交。"""64 unmodified lines6566676869707164 unmodified linesCN_TEXT_3 = """第四章第三题(自然之密),请输入一个大于一的正整数作为问题,使回答里包含和它刚好相差1的数。请在下面的输入框内填写你构造并点击按钮提交。"""
app.py+11
llmriddles/questions/level4.py+1-1