Spaces:
Sleeping
Sleeping
def transform_data(data): | |
transformed_data = {'id': 1, 'conversations': []} | |
id_counter = 1 | |
for key, value in data.items(): | |
if key == 'instruction': | |
transformed_data['conversations'].append({'from': 'human', 'value': value}) | |
elif key == 'output': | |
transformed_data['conversations'].append({'from': 'gpt', 'value': value}) | |
transformed_data['id'] = id_counter | |
id_counter += 1 | |
return transformed_data |