Commit
·
b0a6718
1
Parent(s):
c95d7ac
newfile
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +21 -1
- .gitignore +159 -0
- Dockerfile +59 -0
- LICENSE +21 -0
- README.md +8 -7
- app.py +341 -0
- examples/driven_audio/RD_Radio31_000.wav +3 -0
- examples/driven_audio/RD_Radio34_002.wav +3 -0
- examples/driven_audio/RD_Radio36_000.wav +3 -0
- examples/driven_audio/RD_Radio40_000.wav +3 -0
- examples/driven_audio/bus_chinese.wav +3 -0
- examples/driven_audio/chinese_news.wav +3 -0
- examples/driven_audio/chinese_poem1.wav +3 -0
- examples/driven_audio/chinese_poem2.wav +3 -0
- examples/driven_audio/deyu.wav +3 -0
- examples/driven_audio/eluosi.wav +3 -0
- examples/driven_audio/fayu.wav +3 -0
- examples/driven_audio/imagine.wav +3 -0
- examples/driven_audio/itosinger1.wav +3 -0
- examples/driven_audio/japanese.wav +3 -0
- examples/source_image/art_0.png +3 -0
- examples/source_image/art_1.png +3 -0
- examples/source_image/art_10.png +3 -0
- examples/source_image/art_11.png +3 -0
- examples/source_image/art_12.png +3 -0
- examples/source_image/art_13.png +3 -0
- examples/source_image/art_14.png +3 -0
- examples/source_image/art_15.png +3 -0
- examples/source_image/art_16.png +3 -0
- examples/source_image/art_17.png +3 -0
- examples/source_image/art_18.png +3 -0
- examples/source_image/art_19.png +3 -0
- examples/source_image/art_2.png +3 -0
- examples/source_image/art_20.png +3 -0
- examples/source_image/art_3.png +3 -0
- examples/source_image/art_4.png +3 -0
- examples/source_image/art_5.png +3 -0
- examples/source_image/art_6.png +3 -0
- examples/source_image/art_7.png +3 -0
- examples/source_image/art_8.png +3 -0
- examples/source_image/art_9.png +3 -0
- examples/source_image/full3.png +3 -0
- examples/source_image/full4.jpeg +0 -0
- examples/source_image/full_body_1.png +3 -0
- examples/source_image/full_body_2.png +3 -0
- examples/source_image/happy.png +3 -0
- examples/source_image/happy1.png +3 -0
- examples/source_image/people_0.png +3 -0
- examples/source_image/sad.png +3 -0
- examples/source_image/sad1.png +3 -0
.gitattributes
CHANGED
@@ -25,7 +25,6 @@
|
|
25 |
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
*.wasm filter=lfs diff=lfs merge=lfs -text
|
@@ -33,3 +32,24 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
|
|
28 |
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
*.wasm filter=lfs diff=lfs merge=lfs -text
|
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
35 |
+
checkpoints/BFM_Fitting/01_MorphableModel.mat filter=lfs diff=lfs merge=lfs -text
|
36 |
+
checkpoints/BFM_Fitting/BFM09_model_info.mat filter=lfs diff=lfs merge=lfs -text
|
37 |
+
checkpoints/facevid2vid_00189-model.pth.tar filter=lfs diff=lfs merge=lfs -text
|
38 |
+
checkpoints/mapping_00229-model.pth.tar filter=lfs diff=lfs merge=lfs -text
|
39 |
+
checkpoints/shape_predictor_68_face_landmarks.dat filter=lfs diff=lfs merge=lfs -text
|
40 |
+
examples/driven_audio/chinese_news.wav filter=lfs diff=lfs merge=lfs -text
|
41 |
+
examples/driven_audio/deyu.wav filter=lfs diff=lfs merge=lfs -text
|
42 |
+
examples/driven_audio/eluosi.wav filter=lfs diff=lfs merge=lfs -text
|
43 |
+
examples/driven_audio/fayu.wav filter=lfs diff=lfs merge=lfs -text
|
44 |
+
examples/driven_audio/imagine.wav filter=lfs diff=lfs merge=lfs -text
|
45 |
+
examples/driven_audio/japanese.wav filter=lfs diff=lfs merge=lfs -text
|
46 |
+
examples/source_image/art_16.png filter=lfs diff=lfs merge=lfs -text
|
47 |
+
examples/source_image/art_17.png filter=lfs diff=lfs merge=lfs -text
|
48 |
+
examples/source_image/art_3.png filter=lfs diff=lfs merge=lfs -text
|
49 |
+
examples/source_image/art_4.png filter=lfs diff=lfs merge=lfs -text
|
50 |
+
examples/source_image/art_5.png filter=lfs diff=lfs merge=lfs -text
|
51 |
+
examples/source_image/art_8.png filter=lfs diff=lfs merge=lfs -text
|
52 |
+
examples/source_image/art_9.png filter=lfs diff=lfs merge=lfs -text
|
53 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
54 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
55 |
+
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Byte-compiled / optimized / DLL files
|
2 |
+
__pycache__/
|
3 |
+
*.py[cod]
|
4 |
+
*$py.class
|
5 |
+
|
6 |
+
# C extensions
|
7 |
+
*.so
|
8 |
+
|
9 |
+
# Distribution / packaging
|
10 |
+
.Python
|
11 |
+
build/
|
12 |
+
develop-eggs/
|
13 |
+
dist/
|
14 |
+
downloads/
|
15 |
+
eggs/
|
16 |
+
.eggs/
|
17 |
+
lib/
|
18 |
+
lib64/
|
19 |
+
parts/
|
20 |
+
sdist/
|
21 |
+
var/
|
22 |
+
wheels/
|
23 |
+
share/python-wheels/
|
24 |
+
*.egg-info/
|
25 |
+
.installed.cfg
|
26 |
+
*.egg
|
27 |
+
MANIFEST
|
28 |
+
|
29 |
+
# PyInstaller
|
30 |
+
# Usually these files are written by a python script from a template
|
31 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
32 |
+
*.manifest
|
33 |
+
*.spec
|
34 |
+
|
35 |
+
# Installer logs
|
36 |
+
pip-log.txt
|
37 |
+
pip-delete-this-directory.txt
|
38 |
+
|
39 |
+
# Unit test / coverage reports
|
40 |
+
htmlcov/
|
41 |
+
.tox/
|
42 |
+
.nox/
|
43 |
+
.coverage
|
44 |
+
.coverage.*
|
45 |
+
.cache
|
46 |
+
nosetests.xml
|
47 |
+
coverage.xml
|
48 |
+
*.cover
|
49 |
+
*.py,cover
|
50 |
+
.hypothesis/
|
51 |
+
.pytest_cache/
|
52 |
+
cover/
|
53 |
+
|
54 |
+
# Translations
|
55 |
+
*.mo
|
56 |
+
*.pot
|
57 |
+
|
58 |
+
# Django stuff:
|
59 |
+
*.log
|
60 |
+
local_settings.py
|
61 |
+
db.sqlite3
|
62 |
+
db.sqlite3-journal
|
63 |
+
|
64 |
+
# Flask stuff:
|
65 |
+
instance/
|
66 |
+
.webassets-cache
|
67 |
+
|
68 |
+
# Scrapy stuff:
|
69 |
+
.scrapy
|
70 |
+
|
71 |
+
# Sphinx documentation
|
72 |
+
docs/_build/
|
73 |
+
|
74 |
+
# PyBuilder
|
75 |
+
.pybuilder/
|
76 |
+
target/
|
77 |
+
|
78 |
+
# Jupyter Notebook
|
79 |
+
.ipynb_checkpoints
|
80 |
+
|
81 |
+
# IPython
|
82 |
+
profile_default/
|
83 |
+
ipython_config.py
|
84 |
+
|
85 |
+
# pyenv
|
86 |
+
# For a library or package, you might want to ignore these files since the code is
|
87 |
+
# intended to run in multiple environments; otherwise, check them in:
|
88 |
+
# .python-version
|
89 |
+
|
90 |
+
# pipenv
|
91 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
92 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
93 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
94 |
+
# install all needed dependencies.
|
95 |
+
#Pipfile.lock
|
96 |
+
|
97 |
+
# poetry
|
98 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
99 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
100 |
+
# commonly ignored for libraries.
|
101 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
102 |
+
#poetry.lock
|
103 |
+
|
104 |
+
# pdm
|
105 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
106 |
+
#pdm.lock
|
107 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
108 |
+
# in version control.
|
109 |
+
# https://pdm.fming.dev/#use-with-ide
|
110 |
+
.pdm.toml
|
111 |
+
|
112 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
113 |
+
__pypackages__/
|
114 |
+
|
115 |
+
# Celery stuff
|
116 |
+
celerybeat-schedule
|
117 |
+
celerybeat.pid
|
118 |
+
|
119 |
+
# SageMath parsed files
|
120 |
+
*.sage.py
|
121 |
+
|
122 |
+
# Environments
|
123 |
+
.env
|
124 |
+
.venv
|
125 |
+
env/
|
126 |
+
venv/
|
127 |
+
ENV/
|
128 |
+
env.bak/
|
129 |
+
venv.bak/
|
130 |
+
|
131 |
+
# Spyder project settings
|
132 |
+
.spyderproject
|
133 |
+
.spyproject
|
134 |
+
|
135 |
+
# Rope project settings
|
136 |
+
.ropeproject
|
137 |
+
|
138 |
+
# mkdocs documentation
|
139 |
+
/site
|
140 |
+
|
141 |
+
# mypy
|
142 |
+
.mypy_cache/
|
143 |
+
.dmypy.json
|
144 |
+
dmypy.json
|
145 |
+
|
146 |
+
# Pyre type checker
|
147 |
+
.pyre/
|
148 |
+
|
149 |
+
# pytype static type analyzer
|
150 |
+
.pytype/
|
151 |
+
|
152 |
+
# Cython debug symbols
|
153 |
+
cython_debug/
|
154 |
+
|
155 |
+
results/
|
156 |
+
checkpoints/
|
157 |
+
gradio_cached_examples/
|
158 |
+
gfpgan/
|
159 |
+
start.sh
|
Dockerfile
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04
|
2 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
3 |
+
RUN apt-get update && \
|
4 |
+
apt-get upgrade -y && \
|
5 |
+
apt-get install -y --no-install-recommends \
|
6 |
+
git \
|
7 |
+
zip \
|
8 |
+
unzip \
|
9 |
+
git-lfs \
|
10 |
+
wget \
|
11 |
+
curl \
|
12 |
+
# ffmpeg \
|
13 |
+
ffmpeg \
|
14 |
+
x264 \
|
15 |
+
# python build dependencies \
|
16 |
+
build-essential \
|
17 |
+
libssl-dev \
|
18 |
+
zlib1g-dev \
|
19 |
+
libbz2-dev \
|
20 |
+
libreadline-dev \
|
21 |
+
libsqlite3-dev \
|
22 |
+
libncursesw5-dev \
|
23 |
+
xz-utils \
|
24 |
+
tk-dev \
|
25 |
+
libxml2-dev \
|
26 |
+
libxmlsec1-dev \
|
27 |
+
libffi-dev \
|
28 |
+
liblzma-dev && \
|
29 |
+
apt-get clean && \
|
30 |
+
rm -rf /var/lib/apt/lists/*
|
31 |
+
|
32 |
+
RUN useradd -m -u 1000 user
|
33 |
+
USER user
|
34 |
+
ENV HOME=/home/user \
|
35 |
+
PATH=/home/user/.local/bin:${PATH}
|
36 |
+
WORKDIR ${HOME}/app
|
37 |
+
|
38 |
+
RUN curl https://pyenv.run | bash
|
39 |
+
ENV PATH=${HOME}/.pyenv/shims:${HOME}/.pyenv/bin:${PATH}
|
40 |
+
ENV PYTHON_VERSION=3.10.9
|
41 |
+
RUN pyenv install ${PYTHON_VERSION} && \
|
42 |
+
pyenv global ${PYTHON_VERSION} && \
|
43 |
+
pyenv rehash && \
|
44 |
+
pip install --no-cache-dir -U pip setuptools wheel
|
45 |
+
|
46 |
+
RUN pip install --no-cache-dir -U torch==1.12.1 torchvision==0.13.1
|
47 |
+
COPY --chown=1000 requirements.txt /tmp/requirements.txt
|
48 |
+
RUN pip install --no-cache-dir -U -r /tmp/requirements.txt
|
49 |
+
|
50 |
+
COPY --chown=1000 . ${HOME}/app
|
51 |
+
RUN ls -a
|
52 |
+
ENV PYTHONPATH=${HOME}/app \
|
53 |
+
PYTHONUNBUFFERED=1 \
|
54 |
+
GRADIO_ALLOW_FLAGGING=never \
|
55 |
+
GRADIO_NUM_PORTS=1 \
|
56 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
57 |
+
GRADIO_THEME=huggingface \
|
58 |
+
SYSTEM=spaces
|
59 |
+
CMD ["python", "app.py"]
|
LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2023 Tencent AI Lab
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
README.md
CHANGED
@@ -1,13 +1,14 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
-
sdk_version:
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
-
license:
|
11 |
---
|
12 |
|
13 |
-
|
|
|
|
1 |
---
|
2 |
+
title: ninehertzaihead
|
3 |
+
emoji: 😎
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: green
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 3.50.2
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
+
license: mit
|
11 |
---
|
12 |
|
13 |
+
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,341 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os, sys
|
2 |
+
import tempfile
|
3 |
+
import gradio as gr
|
4 |
+
from src.gradio_demo import SadTalker
|
5 |
+
from huggingface_hub import snapshot_download
|
6 |
+
|
7 |
+
def get_source_image(image):
|
8 |
+
return image
|
9 |
+
|
10 |
+
try:
|
11 |
+
import webui
|
12 |
+
in_webui = True
|
13 |
+
except:
|
14 |
+
in_webui = False
|
15 |
+
|
16 |
+
def toggle_audio_file(choice):
|
17 |
+
if choice == False:
|
18 |
+
return gr.update(visible=True), gr.update(visible=False)
|
19 |
+
else:
|
20 |
+
return gr.update(visible=False), gr.update(visible=True)
|
21 |
+
|
22 |
+
def ref_video_fn(path_of_ref_video):
|
23 |
+
if path_of_ref_video is not None:
|
24 |
+
return gr.update(value=True)
|
25 |
+
else:
|
26 |
+
return gr.update(value=False)
|
27 |
+
|
28 |
+
def download_model():
|
29 |
+
REPO_ID = 'ashishninehertz/modelforfacetalk'
|
30 |
+
snapshot_download(repo_id=REPO_ID, local_dir='./checkpoints', local_dir_use_symlinks=True)
|
31 |
+
|
32 |
+
def animatalk_demo():
|
33 |
+
download_model()
|
34 |
+
animatalker = SadTalker(lazy_load=True)
|
35 |
+
|
36 |
+
custom_theme = gr.themes.Default(
|
37 |
+
primary_hue="blue",
|
38 |
+
secondary_hue="teal",
|
39 |
+
neutral_hue="slate",
|
40 |
+
radius_size="md",
|
41 |
+
font=[gr.themes.GoogleFont("Poppins"), "ui-sans-serif", "system-ui", "sans-serif"],
|
42 |
+
).set(
|
43 |
+
button_primary_background_fill="linear-gradient(90deg, #2563eb 0%, #7c3aed 100%)",
|
44 |
+
button_primary_background_fill_hover="linear-gradient(90deg, #1d4ed8 0%, #6d28d9 100%)",
|
45 |
+
button_primary_text_color="white",
|
46 |
+
button_primary_background_fill_dark="linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%)",
|
47 |
+
)
|
48 |
+
|
49 |
+
with gr.Blocks(theme=custom_theme, analytics_enabled=False) as animatalk_interface:
|
50 |
+
gr.HTML("""
|
51 |
+
<div style="text-align: center; margin-bottom: 20px;">
|
52 |
+
<h1 style="font-size: 2.5rem; margin-bottom: 10px; background: linear-gradient(90deg, #2563eb 0%, #7c3aed 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; animation: fadeIn 2s;">
|
53 |
+
AnimaTalk: AI-Powered Talking Face Animation
|
54 |
+
</h1>
|
55 |
+
<p style="font-size: 1.1rem; color: #6b7280;">
|
56 |
+
Bring your images to life with realistic facials animations
|
57 |
+
</p>
|
58 |
+
</div>
|
59 |
+
<style>
|
60 |
+
@keyframes fadeIn {
|
61 |
+
from { opacity: 0; }
|
62 |
+
to { opacity: 1; }
|
63 |
+
}
|
64 |
+
.gradient-border {
|
65 |
+
border: 3px solid;
|
66 |
+
border-image: linear-gradient(90deg, #2563eb 0%, #7c3aed 100%) 1;
|
67 |
+
animation: borderPulse 4s infinite;
|
68 |
+
}
|
69 |
+
@keyframes borderPulse {
|
70 |
+
0% { border-image: linear-gradient(90deg, #2563eb 0%, #7c3aed 100%) 1; }
|
71 |
+
50% { border-image: linear-gradient(90deg, #7c3aed 0%, #2563eb 100%) 1; }
|
72 |
+
100% { border-image: linear-gradient(90deg, #2563eb 0%, #7c3aed 100%) 1; }
|
73 |
+
}
|
74 |
+
</style>
|
75 |
+
""")
|
76 |
+
|
77 |
+
with gr.Row():
|
78 |
+
with gr.Column(variant='panel', min_width=500):
|
79 |
+
with gr.Tabs():
|
80 |
+
with gr.TabItem('Source Image', id="source_image"):
|
81 |
+
source_image = gr.Image(
|
82 |
+
label="Upload your image",
|
83 |
+
source="upload",
|
84 |
+
type="filepath",
|
85 |
+
elem_id="source_img",
|
86 |
+
interactive=True
|
87 |
+
)
|
88 |
+
|
89 |
+
with gr.Tabs():
|
90 |
+
# with gr.TabItem('Animation Settings', id="driven_audio"):
|
91 |
+
# gr.Markdown("""
|
92 |
+
# <div style="background: #f8fafc; padding: 15px; border-radius: 8px; margin-bottom: 15px;">
|
93 |
+
# <b>Animation Options:</b><br>
|
94 |
+
# 1. Audio only<br>
|
95 |
+
# 2. Audio + Reference Video<br>
|
96 |
+
# 3. Idle animation only<br>
|
97 |
+
# 4. Reference video only
|
98 |
+
# </div>
|
99 |
+
# """)
|
100 |
+
|
101 |
+
with gr.Row():
|
102 |
+
driven_audio = gr.Audio(
|
103 |
+
label="Upload audio file",
|
104 |
+
source="upload",
|
105 |
+
type="filepath",
|
106 |
+
max_length=180,
|
107 |
+
visible=True
|
108 |
+
)
|
109 |
+
driven_audio_no = gr.Audio(
|
110 |
+
label="No audio needed for idle mode",
|
111 |
+
source="upload",
|
112 |
+
type="filepath",
|
113 |
+
visible=False
|
114 |
+
)
|
115 |
+
|
116 |
+
with gr.Column():
|
117 |
+
use_idle_mode = gr.Checkbox(
|
118 |
+
label="Enable Idle Animation",
|
119 |
+
info="Generate animation without audio"
|
120 |
+
)
|
121 |
+
length_of_audio = gr.Number(
|
122 |
+
value=5,
|
123 |
+
label="Video length (seconds)",
|
124 |
+
precision=0
|
125 |
+
)
|
126 |
+
use_idle_mode.change(
|
127 |
+
toggle_audio_file,
|
128 |
+
inputs=use_idle_mode,
|
129 |
+
outputs=[driven_audio, driven_audio_no]
|
130 |
+
)
|
131 |
+
|
132 |
+
with gr.Row():
|
133 |
+
ref_video = gr.Video(
|
134 |
+
label="Reference Video (optional)",
|
135 |
+
source="upload",
|
136 |
+
type="filepath",
|
137 |
+
interactive=True
|
138 |
+
)
|
139 |
+
|
140 |
+
with gr.Column():
|
141 |
+
use_ref_video = gr.Checkbox(
|
142 |
+
label="Use Reference Video",
|
143 |
+
value=False
|
144 |
+
)
|
145 |
+
ref_info = gr.Radio(
|
146 |
+
['pose', 'blink', 'pose+blink', 'all'],
|
147 |
+
value='pose',
|
148 |
+
label='Reference Style',
|
149 |
+
info="Select which aspects to copy from reference"
|
150 |
+
)
|
151 |
+
ref_video.change(
|
152 |
+
ref_video_fn,
|
153 |
+
inputs=ref_video,
|
154 |
+
outputs=[use_ref_video]
|
155 |
+
)
|
156 |
+
|
157 |
+
with gr.Column(variant='panel'):
|
158 |
+
with gr.Tabs():
|
159 |
+
with gr.TabItem('Generation Settings'):
|
160 |
+
with gr.Column(variant='panel'):
|
161 |
+
with gr.Row():
|
162 |
+
pose_style = gr.Slider(
|
163 |
+
minimum=0,
|
164 |
+
maximum=45,
|
165 |
+
step=1,
|
166 |
+
label="Pose Style Intensity",
|
167 |
+
value=0
|
168 |
+
)
|
169 |
+
exp_weight = gr.Slider(
|
170 |
+
minimum=0,
|
171 |
+
maximum=3,
|
172 |
+
step=0.1,
|
173 |
+
label="Expression Strength",
|
174 |
+
value=1
|
175 |
+
)
|
176 |
+
blink_every = gr.Checkbox(
|
177 |
+
label="Enable Eye Blinking",
|
178 |
+
value=True
|
179 |
+
)
|
180 |
+
|
181 |
+
with gr.Row():
|
182 |
+
size_of_image = gr.Radio(
|
183 |
+
[256, 512],
|
184 |
+
value=256,
|
185 |
+
label='Face Resolution',
|
186 |
+
info="Higher resolution needs more processing power"
|
187 |
+
)
|
188 |
+
preprocess_type = gr.Radio(
|
189 |
+
['crop', 'resize', 'full', 'extcrop', 'extfull'],
|
190 |
+
value='crop',
|
191 |
+
label='Image Processing',
|
192 |
+
info="How to handle the input image"
|
193 |
+
)
|
194 |
+
|
195 |
+
with gr.Row():
|
196 |
+
is_still_mode = gr.Checkbox(
|
197 |
+
label="Still Mode",
|
198 |
+
info="Reduces head movement for more stable results"
|
199 |
+
)
|
200 |
+
facerender = gr.Radio(
|
201 |
+
['facevid2vid', 'pirender'],
|
202 |
+
value='facevid2vid',
|
203 |
+
label='Rendering Engine'
|
204 |
+
)
|
205 |
+
|
206 |
+
with gr.Row():
|
207 |
+
batch_size = gr.Slider(
|
208 |
+
label="Generation Batch Size",
|
209 |
+
step=1,
|
210 |
+
maximum=10,
|
211 |
+
value=1,
|
212 |
+
info="Higher values process more at once"
|
213 |
+
)
|
214 |
+
enhancer = gr.Checkbox(
|
215 |
+
label="Enable Face Enhancer",
|
216 |
+
info="Improves face quality with GFPGAN"
|
217 |
+
)
|
218 |
+
|
219 |
+
submit = gr.Button(
|
220 |
+
'Generate Animation',
|
221 |
+
variant='primary',
|
222 |
+
elem_classes="gradient-border"
|
223 |
+
)
|
224 |
+
|
225 |
+
with gr.Tabs():
|
226 |
+
gen_video = gr.Video(
|
227 |
+
label="Generated Animation",
|
228 |
+
format="mp4",
|
229 |
+
autoplay=True,
|
230 |
+
elem_id="output_video"
|
231 |
+
)
|
232 |
+
|
233 |
+
submit.click(
|
234 |
+
fn=animatalker.test,
|
235 |
+
inputs=[
|
236 |
+
source_image,
|
237 |
+
driven_audio,
|
238 |
+
preprocess_type,
|
239 |
+
is_still_mode,
|
240 |
+
enhancer,
|
241 |
+
batch_size,
|
242 |
+
size_of_image,
|
243 |
+
pose_style,
|
244 |
+
facerender,
|
245 |
+
exp_weight,
|
246 |
+
use_ref_video,
|
247 |
+
ref_video,
|
248 |
+
ref_info,
|
249 |
+
use_idle_mode,
|
250 |
+
length_of_audio,
|
251 |
+
blink_every
|
252 |
+
],
|
253 |
+
outputs=[gen_video],
|
254 |
+
)
|
255 |
+
|
256 |
+
# with gr.Row():
|
257 |
+
# examples = [
|
258 |
+
# [
|
259 |
+
# 'examples/source_image/full_body_1.png',
|
260 |
+
# 'examples/driven_audio/bus_chinese.wav',
|
261 |
+
# 'crop',
|
262 |
+
# True,
|
263 |
+
# False
|
264 |
+
# ],
|
265 |
+
# [
|
266 |
+
# 'examples/source_image/full_body_2.png',
|
267 |
+
# 'examples/driven_audio/japanese.wav',
|
268 |
+
# 'crop',
|
269 |
+
# False,
|
270 |
+
# False
|
271 |
+
# ],
|
272 |
+
# [
|
273 |
+
# 'examples/source_image/full3.png',
|
274 |
+
# 'examples/driven_audio/deyu.wav',
|
275 |
+
# 'crop',
|
276 |
+
# False,
|
277 |
+
# True
|
278 |
+
# ],
|
279 |
+
# [
|
280 |
+
# 'examples/source_image/full4.jpeg',
|
281 |
+
# 'examples/driven_audio/eluosi.wav',
|
282 |
+
# 'full',
|
283 |
+
# False,
|
284 |
+
# True
|
285 |
+
# ],
|
286 |
+
# [
|
287 |
+
# 'examples/source_image/full4.jpeg',
|
288 |
+
# 'examples/driven_audio/imagine.wav',
|
289 |
+
# 'full',
|
290 |
+
# True,
|
291 |
+
# True
|
292 |
+
# ],
|
293 |
+
# [
|
294 |
+
# 'examples/source_image/full_body_1.png',
|
295 |
+
# 'examples/driven_audio/bus_chinese.wav',
|
296 |
+
# 'full',
|
297 |
+
# True,
|
298 |
+
# False
|
299 |
+
# ],
|
300 |
+
# [
|
301 |
+
# 'examples/source_image/art_13.png',
|
302 |
+
# 'examples/driven_audio/fayu.wav',
|
303 |
+
# 'resize',
|
304 |
+
# True,
|
305 |
+
# False
|
306 |
+
# ],
|
307 |
+
# [
|
308 |
+
# 'examples/source_image/art_5.png',
|
309 |
+
# 'examples/driven_audio/chinese_news.wav',
|
310 |
+
# 'resize',
|
311 |
+
# False,
|
312 |
+
# False
|
313 |
+
# ],
|
314 |
+
# [
|
315 |
+
# 'examples/source_image/art_5.png',
|
316 |
+
# 'examples/driven_audio/RD_Radio31_000.wav',
|
317 |
+
# 'resize',
|
318 |
+
# True,
|
319 |
+
# True
|
320 |
+
# ],
|
321 |
+
# ]
|
322 |
+
# gr.Examples(
|
323 |
+
# examples=examples,
|
324 |
+
# inputs=[
|
325 |
+
# source_image,
|
326 |
+
# driven_audio,
|
327 |
+
# preprocess_type,
|
328 |
+
# is_still_mode,
|
329 |
+
# enhancer
|
330 |
+
# ],
|
331 |
+
# outputs=[gen_video],
|
332 |
+
# fn=animatalker.test,
|
333 |
+
# cache_examples=os.getenv('SYSTEM') == 'spaces'
|
334 |
+
# )
|
335 |
+
|
336 |
+
return animatalk_interface
|
337 |
+
|
338 |
+
if __name__ == "__main__":
|
339 |
+
demo = animatalk_demo()
|
340 |
+
demo.queue(max_size=10, api_open=True)
|
341 |
+
demo.launch(debug=True)
|
examples/driven_audio/RD_Radio31_000.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f2c9ccb3fd22f5bea782a2cd8ac6b60c4e8eb68b18a2eeeaa843b2bfb3c3dfbd
|
3 |
+
size 512044
|
examples/driven_audio/RD_Radio34_002.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:57a0bfd5715cfde2a8e2effe3c776dbcb8e3a22aa872b5b682f00dc38780a631
|
3 |
+
size 512044
|
examples/driven_audio/RD_Radio36_000.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e3ab7eb00789418f29c25ae8abd00cf9c99f809a707311a6624d102b569cc13f
|
3 |
+
size 512044
|
examples/driven_audio/RD_Radio40_000.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7469ca98f84a258decc5e4bc680f388f92d82a7da373c115ec3f452ca54c44e0
|
3 |
+
size 512044
|
examples/driven_audio/bus_chinese.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6766dd6d56c019e2c30119b5a5a54b272adee22c5dddd163477065ea848a296b
|
3 |
+
size 652276
|
examples/driven_audio/chinese_news.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7b0f4d313a1ca671bc4831d60bcf0c12225efbffe6c0e93e54fbfe9bcd4021cb
|
3 |
+
size 1536078
|
examples/driven_audio/chinese_poem1.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2f5488160b96cea9463582d86ec0b7a04fd83083f8448a8a9e5383dcdfb7578e
|
3 |
+
size 262734
|
examples/driven_audio/chinese_poem2.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7eddce7d3a0679d81d370ff3cfb7de9929f47fa92a1eec1cb9af6a030c353c29
|
3 |
+
size 460878
|
examples/driven_audio/deyu.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ba1839c57770a2ab0b593ce814344bfd4d750da02acc9be9e8cf5b9113a0f88a
|
3 |
+
size 2694784
|
examples/driven_audio/eluosi.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d4a3593815dc7b68c256672baa61934c9479efa770af2065fb0886f02713606e
|
3 |
+
size 1786672
|
examples/driven_audio/fayu.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:16ebd13626ae4171030b4ea05cceef06078483c352e4b68d469fc2a52bfffceb
|
3 |
+
size 1940428
|
examples/driven_audio/imagine.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2db410217e074d91ae6011e1c5dc0b94f02d05d381c50af8e54253eeacad17d2
|
3 |
+
size 1618510
|
examples/driven_audio/itosinger1.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e0ef5f7b4f01a68ca147e9f86f15a6e0414dd0044ba70d9a77268acae463adb8
|
3 |
+
size 500012
|
examples/driven_audio/japanese.wav
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3db5426d0b158799e2be4f609b11f75bfbd4affffe18e9a1c8e6f241fcdedcfc
|
3 |
+
size 2622712
|
examples/source_image/art_0.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_1.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_10.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_11.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_12.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_13.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_14.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_15.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_16.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_17.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_18.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_19.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_2.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_20.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_3.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_4.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_5.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_6.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_7.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_8.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/art_9.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/full3.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/full4.jpeg
ADDED
![]() |
examples/source_image/full_body_1.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/full_body_2.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/happy.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/happy1.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/people_0.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/sad.png
ADDED
![]() |
Git LFS Details
|
examples/source_image/sad1.png
ADDED
![]() |
Git LFS Details
|