Spaces:
Sleeping
Sleeping
File size: 462 Bytes
10c1f9c |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
def transform_data(data):
transformed_data = {
'id': data['id'],
'conversations': []
}
for conversation in data['conversations']:
if conversation['from'] == 'human':
transformed_data['conversations'].append({'input': conversation['value']})
elif conversation['from'] == 'gpt':
transformed_data['conversations'][-1]['output'] = conversation['value']
return transformed_data |