Spaces:
Sleeping
Sleeping
def transform_data(data): | |
conversations = [] | |
for item in data.get('conversation', []): | |
conversations.append({ | |
"from" : "human", | |
"value" : item.get("input", "") | |
}) | |
conversations.append({ | |
"from" : "gpt", | |
"value" : item.get("output", "") | |
}) | |
transformed_data = { | |
"id": hash(data['source']), | |
"conversations": conversations | |
} | |
return transformed_data |