user_response / Counting.py
zihaowei's picture
update
c9c2725
Raw
History Blame Contribute Delete
1.21 kB
import os
import json
Counting= {}
Counting["Image 1"] = 0
Counting["Image 2"] = 0
Counting["Both good"] = 0
Counting["Both bad"] = 0
total = 0
for i in os.listdir("."):
if i.split(".")[-1]=="json":
with open(i,"r") as f:
data = json.load(f)
result = data["audio_image_responses"]
for response in result:
total +=1
if response["selected_image"] == "Can not decide":
total -=1
else:
Counting[response["selected_image"]] +=1
for k in Counting:
print(k,Counting[k]/total)
Counting= {}
Counting["Audio 1"] = 0
Counting["Audio 2"] = 0
Counting["Both good"] = 0
Counting["Both bad"] = 0
total = 0
for i in os.listdir("."):
if i.split(".")[-1]=="json":
with open(i,"r") as f:
data = json.load(f)
result = data["image_audio_responses"]
for response in result:
total +=1
if response["selected_audio"] == "Can not decide":
total -=1
else:
Counting[response["selected_audio"]] +=1
for k in Counting:
print(k,Counting[k]/total)