TrueMICL / clevr /dataprocess2.py
ShuoChen99's picture
Upload folder using huggingface_hub
1e9a83f verified
import json
# ?????????
input_file = "support.json"
output_file = "support.json"
# ???? question ??
new_question = "I want to count objects in one specific color. How many of them are in my desired color?"
# ?? JSON ??
def update_question_field(input_file, output_file, new_question):
with open(input_file, "r") as file:
data = json.load(file)
# ??????,?? question ??
for entry in data:
if "question" in entry:
entry["question"] = new_question
# ?????? JSON ??
with open(output_file, "w") as file:
json.dump(data, file, indent=4)
print(f"Updated questions have been saved to {output_file}")
# ????
update_question_field(input_file, output_file, new_question)