def run(self): datasetFile = 'CSVdataset - Sheet1.csv' df = pd.read_csv(datasetFile) # Create a new Faker and tell it how to create User objects for index, dataset in df.iterrows(): # print(dataset['paragraph']) dt = Dataset(dataset['paragraph'], dataset['intent'], 'nocontext') self.db.session.add(dt)
def store(): context = 'nocontext' intent = request.json['intent'] paragraph = request.json['paragraph'] if 'context' in request.json: context = request.json['context'] dataset = Dataset(context=context, intent=intent, paragraph=paragraph) db.session.add(dataset) db.session.commit() data = singleTransform(dataset) return responses.created(data, 'Dataset successfully created')