import json

with open("/home/ubuntu/50T/fsy/benchmark/ScienceQA/ScienceQA-mat.json", 'r', encoding='utf-8') as f:
    data = json.load(f)
    
filtered_data = {}

for key, item in data.items():
    if item.get("image") is None:
        filtered_data[key] = item

with open("/home/ubuntu/50T/fsy/benchmark/ScienceQA/filtered_output.json", 'w', encoding='utf-8') as f:
    json.dump(filtered_data, f, ensure_ascii=False, indent=4)

print(f"筛选完成，共筛选出 {len(filtered_data)} 条数据，并保存在 'filtered_output.json' 文件中。")