Spaces:
Build error
Build error
Commit
·
3d63486
1
Parent(s):
92bb01c
update reqs
Browse files- app.py +5 -8
- requirements.txt +9 -3
app.py
CHANGED
@@ -59,19 +59,16 @@ def inference(video_path, text):
|
|
59 |
y = np.expand_dims(A,axis=0)
|
60 |
z = np.expand_dims(V,axis=0)
|
61 |
x, y, z = torch.from_numpy(x).to(device), torch.from_numpy(y).to(device), torch.from_numpy(z).float().to(device)
|
62 |
-
pred = net(x, y, z).cpu().data.numpy()
|
|
|
|
|
63 |
label_to_ix = ['happy', 'sad', 'angry', 'fear', 'disgust', 'surprise']
|
64 |
-
result_dict =
|
65 |
return result_dict
|
66 |
|
67 |
|
68 |
title="Emotion Recognition"
|
69 |
-
description="
|
70 |
-
To use it, simply upload your video, or click one of the examples to load them.\
|
71 |
-
This demo and model represent the work of \"Achieving Face Swapped Deepfakes Detection Using EfficientNetV2\" by Lee Sheng Yeh. \
|
72 |
-
The examples were extracted from Celeb-DF(V2)(Li et al, 2020) and FaceForensics++(Rossler et al., 2019). Full reference details is available in \"references.txt.\" \
|
73 |
-
The examples are used under fair use to demo the working of the model only. If any copyright is infringed, please contact the researcher via this email: tp054565@mail.apu.edu.my, the researcher will immediately take down the examples used.\
|
74 |
-
"
|
75 |
|
76 |
examples = [
|
77 |
['examples/03bSnISJMiM_1.mp4', "IT WAS REALLY GOOD "],
|
|
|
59 |
y = np.expand_dims(A,axis=0)
|
60 |
z = np.expand_dims(V,axis=0)
|
61 |
x, y, z = torch.from_numpy(x).to(device), torch.from_numpy(y).to(device), torch.from_numpy(z).float().to(device)
|
62 |
+
pred = net(x, y, z).cpu().data.numpy()[0]
|
63 |
+
# normalize between 0 and 1
|
64 |
+
pred = (pred + pred.min()) / (pred.max() - pred.min())
|
65 |
label_to_ix = ['happy', 'sad', 'angry', 'fear', 'disgust', 'surprise']
|
66 |
+
result_dict = {label_to_ix[i]: float(pred[i]) for i in range(len(label_to_ix))}
|
67 |
return result_dict
|
68 |
|
69 |
|
70 |
title="Emotion Recognition"
|
71 |
+
description=""
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
examples = [
|
74 |
['examples/03bSnISJMiM_1.mp4', "IT WAS REALLY GOOD "],
|
requirements.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
gradio==2.8.5
|
2 |
+
librosa==0.9.1
|
3 |
+
soundfile==0.10.3.post1
|
4 |
+
matplotlib==3.5.1
|
5 |
+
numpy==1.21.2
|
6 |
+
scipy==1.5.3
|
7 |
+
tensorflow==2.8.0
|
8 |
+
torch==1.10.1
|
9 |
+
https://github.com/explosion/spacy-models/releases/download/en_vectors_web_lg-2.1.0/en_vectors_web_lg-2.1.0.tar.gz
|