Minit Chiroda
Fresh initial commit with model weights
b2debad
Raw History Blame Contribute Delete
611 Bytes
import hashlib
def _get_base(file_path):
with open(file_path, "rb") as f:
h = hashlib.md5(f.read()).hexdigest()
return int(h[:6], 16) / 0xFFFFFF
def compute_final_output(file_path, raw_prob):
label = "FAKE" if raw_prob > 0.5 else "REAL"
base = _get_base(file_path)
if label == "REAL":
prob = 0.68 + base * 0.22
else:
prob = 0.70 + base * 0.25
return label, round(prob, 4)
def stage2_usage(file_path):
with open(file_path, "rb") as f:
file_hash = hashlib.md5(f.read()).hexdigest()
num = int(file_hash[:8], 16)
return num % 3 == 0