Spaces:
Runtime error
Runtime error
malmukhtar
commited on
Commit
·
b164597
1
Parent(s):
a2c56f0
Update app.py
Browse files
app.py
CHANGED
@@ -61,6 +61,8 @@ def inference(vid):
|
|
61 |
#return "./Labels/Fake.png", f"{vid}"
|
62 |
vid_real_faces = face_extractor.process_video(vid)
|
63 |
faces_real_t = torch.stack( [ transf(image=frame['faces'][0])['image'] for frame in vid_real_faces if len(frame['faces'])] )
|
|
|
|
|
64 |
res = expit(faces_real_pred.mean())
|
65 |
if res >= 0.5:
|
66 |
return "./Labels/Fake.png", f"{res*100:.2f}%"
|
|
|
61 |
#return "./Labels/Fake.png", f"{vid}"
|
62 |
vid_real_faces = face_extractor.process_video(vid)
|
63 |
faces_real_t = torch.stack( [ transf(image=frame['faces'][0])['image'] for frame in vid_real_faces if len(frame['faces'])] )
|
64 |
+
with torch.no_grad():
|
65 |
+
faces_real_pred = net(faces_real_t.to(device)).cpu().numpy().flatten()
|
66 |
res = expit(faces_real_pred.mean())
|
67 |
if res >= 0.5:
|
68 |
return "./Labels/Fake.png", f"{res*100:.2f}%"
|