CoolFace
Apppublic

bleckhert/Free-View_Expressive_Talking_Head_Video_Editing

sourceHugging Facecc-by-nc-4.0updated 4mo agoView on Hugging Face
0likes
attributtes_utils.py50 linesDownload Raw Back to root
1import os2import sys3 4 5def input_pose(pose_select="front"):6    step = 17    if pose_select == "front":8        pose = [[0.0, 0.0, 0.0] for i in range(0, 10, step)]  # -20 to 209    elif pose_select == "left_right_shaking":10        pose = [[-i, 0.0, 0.0] for i in range(0, 20, step)]  # 0 to -2011        pose += [[i - 20.0, 0.0, 0.0] for i in range(0, 40, step)]  # -20 to 2012        pose += [[20.0 - i, 0.0, 0.0] for i in range(0, 20, step)]  # 20 to 013        pose = pose + pose14        pose = pose + pose15        pose = pose + pose16    else:17        raise ValueError("pose_select Error")18 19    return pose20 21 22EMOTIONS = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"]23 24 25def input_emotion(emotion_select="neutral"):26    sacle_factor = 227    if emotion_select == "neutral":28        emotion = [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0] for _ in range(2)]  # ((i%50))*0.0429    elif emotion_select == "happy":30        emotion = [[0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0] for _ in range(2)]  # ((i%50))*0.0431    elif emotion_select == "angry":32        emotion = [[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] for _ in range(2)]33    elif emotion_select == "surprised":34        emotion = [[0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0] for _ in range(2)]35    else:36        raise ValueError("emotion_select Error")37 38    return emotion * sacle_factor39 40 41def input_blink(blink_select="yes"):42    if blink_select == "yes":43        blink = [[1.0] for _ in range(25)]44        blink += [[0.8], [0.6], [0.0], [0.0]]45        blink += [[1.0] for _ in range(5)]46        blink = blink + blink + blink47    else:48        blink = [[1.0] for _ in range(2)]49    return blink50