wrap funny analysis in SHOWOFF env

This commit is contained in:
Luna 2023-06-10 01:32:54 -03:00
parent 099c7f8fc9
commit 7c94afb01e

41
main.py
View file

@ -335,7 +335,8 @@ async def scores(ctx):
}
normalized_scores = {
model: summed_scores[model] / len(all_hashes) for model in summed_scores
model: round(summed_scores[model] / len(all_hashes), 10)
for model in summed_scores
}
print("scores are [worst...best]")
@ -346,29 +347,29 @@ async def scores(ctx):
reverse=True,
):
print(model, normalized_scores[model])
if os.getenv("SHOWOFF", "0") == "1":
print("[", end="")
print("[", end="")
for bad_md5_hash in sorted(
model_scores[model].keys(),
key=lambda md5_hash: model_scores[model][md5_hash]["score"],
)[:4]:
data = model_scores[model][bad_md5_hash]
if os.getenv("DEBUG", "0") == "1":
print(md5_hash, data["score"], " ".join(data["incorrect_tags"]))
else:
print(data["score"], end=",")
print("...", end="")
for bad_md5_hash in sorted(
model_scores[model].keys(),
key=lambda md5_hash: model_scores[model][md5_hash]["score"],
)[:4]:
data = model_scores[model][bad_md5_hash]
if os.getenv("DEBUG", "0") == "1":
print(md5_hash, data["score"], " ".join(data["incorrect_tags"]))
else:
for good_md5_hash in sorted(
model_scores[model].keys(),
key=lambda md5_hash: model_scores[model][md5_hash]["score"],
reverse=True,
)[:4]:
data = model_scores[model][good_md5_hash]
print(data["score"], end=",")
print("...", end="")
for good_md5_hash in sorted(
model_scores[model].keys(),
key=lambda md5_hash: model_scores[model][md5_hash]["score"],
reverse=True,
)[:4]:
data = model_scores[model][good_md5_hash]
print(data["score"], end=",")
print("]")
print("]")
print("most incorrect tags", incorrect_tags_counters[model].most_common(5))