Download attributtes_utils.py from bleckhert/Free-View_Expressive_Talking_Head_Video_Editing: direct link, hf CLI and curl.
- Browser
- Download file 1.64 kB
-
https://huggingface.co/spaces/bleckhert/Free-View_Expressive_Talking_Head_Video_Editing/resolve/main/attributtes_utils.py
- Command line
-
hf download hf://spaces/bleckhert/Free-View_Expressive_Talking_Head_Video_Editing/attributtes_utils.py
-
curl -L -o attributtes_utils.py https://huggingface.co/spaces/bleckhert/Free-View_Expressive_Talking_Head_Video_Editing/resolve/main/attributtes_utils.py
1.64 kB
| import os | |
| import sys | |
| def input_pose(pose_select="front"): | |
| step = 1 | |
| if pose_select == "front": | |
| pose = [[0.0, 0.0, 0.0] for i in range(0, 10, step)] # -20 to 20 | |
| elif pose_select == "left_right_shaking": | |
| pose = [[-i, 0.0, 0.0] for i in range(0, 20, step)] # 0 to -20 | |
| pose += [[i - 20.0, 0.0, 0.0] for i in range(0, 40, step)] # -20 to 20 | |
| pose += [[20.0 - i, 0.0, 0.0] for i in range(0, 20, step)] # 20 to 0 | |
| pose = pose + pose | |
| pose = pose + pose | |
| pose = pose + pose | |
| else: | |
| raise ValueError("pose_select Error") | |
| return pose | |
| EMOTIONS = ["angry", "disgust", "fear", "happy", "sad", "surprise", "neutral"] | |
| def input_emotion(emotion_select="neutral"): | |
| sacle_factor = 2 | |
| if emotion_select == "neutral": | |
| emotion = [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0] for _ in range(2)] # ((i%50))*0.04 | |
| elif emotion_select == "happy": | |
| emotion = [[0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0] for _ in range(2)] # ((i%50))*0.04 | |
| elif emotion_select == "angry": | |
| emotion = [[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] for _ in range(2)] | |
| elif emotion_select == "surprised": | |
| emotion = [[0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0] for _ in range(2)] | |
| else: | |
| raise ValueError("emotion_select Error") | |
| return emotion * sacle_factor | |
| def input_blink(blink_select="yes"): | |
| if blink_select == "yes": | |
| blink = [[1.0] for _ in range(25)] | |
| blink += [[0.8], [0.6], [0.0], [0.0]] | |
| blink += [[1.0] for _ in range(5)] | |
| blink = blink + blink + blink | |
| else: | |
| blink = [[1.0] for _ in range(2)] | |
| return blink | |