File size: 744 Bytes
089c099
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import json
nb_path = r'c:\E\Project\Project B.tech\Multimodal Deepfake Detection\video_detection\notebooks\Video_Deepfake_Detection_Cloud.ipynb'
with open(nb_path, 'r', encoding='utf-8') as f:
    nb = json.load(f)

for cell in nb['cells']:
    if cell['cell_type'] == 'code':
        source = cell['source']
        for i, line in enumerate(source):
            if 'Acc={correct/total:.1%}' in line:
                source[i] = "    acc = correct / total if total > 0 else 0.0\n    tpr = tp / (tp + fn) if (tp + fn) > 0 else 0.0\n    fpr = fp / (fp + tn) if (fp + tn) > 0 else 0.0\n    print(f'\\\\n📊 Results: Acc={acc:.1%}  TPR={tpr:.1%}  FPR={fpr:.1%}')\n"

with open(nb_path, 'w', encoding='utf-8') as f:
    json.dump(nb, f, indent=2)