Skip to content

Commit bac13dd

Browse files
SanderGidevxpy
authored andcommitted
function "inheritance"
1 parent 98531a3 commit bac13dd

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

retro/sadtalker.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,15 @@
4040

4141
MAX_RES = 1920 * 1080
4242

43+
old_generate_blink_seq_randomly = gb.generate_blink_seq_randomly
44+
4345

4446
# the original sadtalker function does not work for short audio
4547
def fixed_generate_blink_seq_randomly(num_frames):
4648
ratio = np.zeros((num_frames, 1))
4749
if int(num_frames / 2) <= 11:
4850
return ratio
49-
frame_id = 0
50-
while frame_id in range(num_frames):
51-
start = random.choice(range(min(10, num_frames), min(int(num_frames / 2), 70)))
52-
if frame_id + start + 5 <= num_frames - 1:
53-
ratio[frame_id + start : frame_id + start + 5, 0] = [
54-
0.5,
55-
0.9,
56-
1.0,
57-
0.9,
58-
0.5,
59-
]
60-
frame_id = frame_id + start + 5
61-
else:
62-
break
63-
return ratio
51+
return old_generate_blink_seq_randomly(num_frames)
6452

6553

6654
# so we patch in a fixed version

0 commit comments

Comments
 (0)