Spaces:
Running
Running
File size: 846 Bytes
39eaf79 2249ab6 39eaf79 2249ab6 39eaf79 2249ab6 bbb241c 2249ab6 bbb241c 2249ab6 bbb241c 2249ab6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import json
import os
from inference import run_inference
from webtest_prompt import build_webtest_prompt
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
TEST_CASES_PATH = os.path.join(BASE_DIR, "test_cases.json")
with open(TEST_CASES_PATH, "r", encoding="utf-8") as f:
TEST_CASES = json.load(f)
def get_case_names():
return [f"{i+1}. {c['input'].get('description','')}" for i, c in enumerate(TEST_CASES)]
def load_cases():
return TEST_CASES
def load_case(idx):
cases = load_cases()
return cases[idx]
def run_case(idx, player_utt):
case = TEST_CASES[idx]["input"].copy()
case["player_utterance"] = player_utt
prompt = build_webtest_prompt(case["npc_id"], case["npc_location"], player_utt)
result = run_inference(prompt)
return result["npc_output_text"], result["deltas"], result["flags_prob"]
|