Spaces:
Sleeping
Sleeping
import json | |
import os | |
def hallucination_t2i_agg(model, result_dir): | |
model = model.split("/")[-1] | |
result_path = os.path.join(result_dir, "hallucination_t2i_summary.json") | |
with open(result_path, "r") as file: | |
results = json.load(file) | |
agg_scores = {} | |
agg_scores["score"] = results[model].pop("Average") | |
agg_scores["subscenarios"] = results[model] | |
return agg_scores | |
def hallucination_i2t_agg(model, result_dir): | |
model = model.split("/")[-1] | |
result_path = os.path.join(result_dir, "hallucination_i2t_summary.json") | |
with open(result_path, "r") as file: | |
results = json.load(file) | |
agg_scores = {} | |
agg_scores["score"] = results[model].pop("Average") | |
agg_scores["subscenarios"] = results[model] | |
return agg_scores | |