Spaces:
Sleeping
Sleeping
import json | |
class Test: | |
def __init__(self): | |
self.data = self.read_test_data() | |
def __len__(self): | |
return len(self.data) | |
def read_test_data(): | |
with open("test.json") as f: | |
test_data = json.load(f) | |
return test_data | |
def get_question(self, idx): | |
question = self.data[idx]["question"] | |
return question | |
def get_answers(self, idx): | |
responces = self.data[idx]["responces"] | |
answers = [responce["answer"] for responce in responces] | |
return answers |