Spaces:
Build error
Build error
Commit
•
2d4dba1
1
Parent(s):
d772085
add more examples
Browse files- app.py +5 -3
- examples/0h-zjBukYpk_19.mp4 +0 -0
- examples/0h-zjBukYpk_2.mp4 +0 -0
app.py
CHANGED
@@ -28,7 +28,7 @@ state_dict = torch.load(ckpts[0], map_location=torch.device(device))['state_dict
|
|
28 |
net = Model_LA(args, len(token_to_ix), pretrained_emb).to(device)
|
29 |
net.load_state_dict(state_dict)
|
30 |
|
31 |
-
def inference(
|
32 |
# data preprocessing
|
33 |
# text
|
34 |
def clean(w):
|
@@ -38,10 +38,10 @@ def inference(video_path, text):
|
|
38 |
w.lower()
|
39 |
).replace('-', ' ').replace('/', ' ')
|
40 |
|
41 |
-
s = [clean(w) for w in
|
42 |
|
43 |
# Sound
|
44 |
-
_, mel, mag = load_spectrograms(
|
45 |
|
46 |
l_max_len = args.lang_seq_len
|
47 |
a_max_len = args.audio_seq_len
|
@@ -70,6 +70,8 @@ title="Emotion Recognition"
|
|
70 |
description=""
|
71 |
|
72 |
examples = [
|
|
|
|
|
73 |
['examples/03bSnISJMiM_1.mp4', "IT WAS REALLY GOOD "],
|
74 |
['examples/03bSnISJMiM_5.mp4', "AND THEY SHOULDVE I GUESS "],
|
75 |
]
|
|
|
28 |
net = Model_LA(args, len(token_to_ix), pretrained_emb).to(device)
|
29 |
net.load_state_dict(state_dict)
|
30 |
|
31 |
+
def inference(source_video, transcription):
|
32 |
# data preprocessing
|
33 |
# text
|
34 |
def clean(w):
|
|
|
38 |
w.lower()
|
39 |
).replace('-', ' ').replace('/', ' ')
|
40 |
|
41 |
+
s = [clean(w) for w in transcription.split() if clean(w) != '']
|
42 |
|
43 |
# Sound
|
44 |
+
_, mel, mag = load_spectrograms(source_video)
|
45 |
|
46 |
l_max_len = args.lang_seq_len
|
47 |
a_max_len = args.audio_seq_len
|
|
|
70 |
description=""
|
71 |
|
72 |
examples = [
|
73 |
+
['examples/0h-zjBukYpk_2.mp4', "NOW IM NOT EVEN GONNA SUGAR COAT THIS THIS MOVIE FRUSTRATED ME TO SUCH AN EXTREME EXTENT THAT I WAS LOUDLY EXCLAIMING WHY AT THE END OF THE FILM"],
|
74 |
+
['examples/0h-zjBukYpk_19.mp4', "NOW OTHER PERFORMANCES ARE BORDERLINE"],
|
75 |
['examples/03bSnISJMiM_1.mp4', "IT WAS REALLY GOOD "],
|
76 |
['examples/03bSnISJMiM_5.mp4', "AND THEY SHOULDVE I GUESS "],
|
77 |
]
|
examples/0h-zjBukYpk_19.mp4
ADDED
Binary file (198 kB). View file
|
|
examples/0h-zjBukYpk_2.mp4
ADDED
Binary file (729 kB). View file
|
|