Duplicate from camenduru/wav2lip
Browse filesCo-authored-by: camenduru <[email protected]>
- .gitattributes +34 -0
- Dockerfile +29 -0
- README.md +11 -0
- app.py +29 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar 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
|
31 |
+
*.xz 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
|
Dockerfile
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/11.2.1/ubuntu2004/devel/cudnn8/Dockerfile
|
2 |
+
FROM nvidia/cuda:11.2.1-cudnn8-devel-ubuntu20.04
|
3 |
+
ENV DEBIAN_FRONTEND noninteractive
|
4 |
+
|
5 |
+
WORKDIR /content
|
6 |
+
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y sudo && apt-get install -y python3-pip && pip3 install --upgrade pip
|
7 |
+
RUN apt-get install -y gnupg wget htop sudo git git-lfs software-properties-common build-essential cmake curl
|
8 |
+
RUN apt-get install -y ffmpeg libavcodec-dev libavformat-dev libavdevice-dev libgl1 libgtk2.0-0 jq libdc1394-22-dev libraw1394-dev libopenblas-base
|
9 |
+
|
10 |
+
ENV PATH="/home/admin/.local/bin:${PATH}"
|
11 |
+
|
12 |
+
RUN pip3 install pandas scipy matplotlib torch torchvision torchaudio gradio altair imageio-ffmpeg pocketsphinx jq "numpy<1.24" yt_dlp ffmpeg-python
|
13 |
+
|
14 |
+
RUN git lfs install
|
15 |
+
|
16 |
+
RUN git clone https://huggingface.co/camenduru/Wav2Lip && cd Wav2Lip
|
17 |
+
COPY app.py /content/app.py
|
18 |
+
|
19 |
+
RUN adduser --disabled-password --gecos '' user
|
20 |
+
|
21 |
+
RUN chown -R user:user /content
|
22 |
+
RUN chmod -R 777 /content
|
23 |
+
USER user
|
24 |
+
|
25 |
+
WORKDIR /content/Wav2Lip
|
26 |
+
|
27 |
+
EXPOSE 7860
|
28 |
+
|
29 |
+
CMD ["python3", "/content/app.py"]
|
README.md
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Wav2lip
|
3 |
+
emoji: 💋
|
4 |
+
colorFrom: red
|
5 |
+
colorTo: red
|
6 |
+
sdk: docker
|
7 |
+
pinned: false
|
8 |
+
duplicated_from: camenduru/wav2lip
|
9 |
+
---
|
10 |
+
|
11 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from yt_dlp import YoutubeDL
|
3 |
+
import os
|
4 |
+
|
5 |
+
def download_video(url):
|
6 |
+
ydl_opts = {'overwrites':True, 'format':'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4', 'outtmpl':'/content/video.mp4'}
|
7 |
+
with YoutubeDL(ydl_opts) as ydl:
|
8 |
+
ydl.download(url)
|
9 |
+
return f"/content/video.mp4"
|
10 |
+
|
11 |
+
def generate(audio_in):
|
12 |
+
print(audio_in)
|
13 |
+
os.system(f"python inference.py --checkpoint_path checkpoints/wav2lip_gan.pth --face '/content/video.mp4' --audio '{audio_in}'")
|
14 |
+
return f"/content/Wav2Lip/results/result_voice.mp4"
|
15 |
+
|
16 |
+
app = gr.Blocks()
|
17 |
+
with app:
|
18 |
+
with gr.Row():
|
19 |
+
with gr.Column():
|
20 |
+
input_text = gr.Textbox(show_label=False, value="https://youtu.be/EU3hIXXeiz4")
|
21 |
+
input_download_button = gr.Button(value="Download from YouTube or Twitch")
|
22 |
+
audio_in = gr.Audio(show_label=False, type='filepath')
|
23 |
+
input_generate_button = gr.Button(value="Generate")
|
24 |
+
with gr.Column():
|
25 |
+
video_out = gr.outputs.Video(label="Output Video")
|
26 |
+
input_download_button.click(download_video, inputs=[input_text], outputs=[video_out])
|
27 |
+
input_generate_button.click(generate, inputs=[audio_in], outputs=[video_out])
|
28 |
+
|
29 |
+
app.launch(debug=True)
|