Spaces:
Runtime error
Runtime error
wav2lip show stdout and duration
Browse files- colab_flask.py +8 -1
colab_flask.py
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
import os
|
|
|
2 |
import time
|
|
|
|
|
3 |
import cv2
|
4 |
from flask import Flask, request, jsonify, send_file
|
5 |
from flask_ngrok2 import run_with_ngrok
|
@@ -72,6 +75,7 @@ def call_wav2lip(video_path, audio_path, output_path):
|
|
72 |
# --face {inputVideoPath} \
|
73 |
# --audio {inputAudioPath} \
|
74 |
# --outfile {lipSyncedOutputPath}
|
|
|
75 |
cmd = [
|
76 |
"python",
|
77 |
"wav2lip/inference.py",
|
@@ -82,7 +86,10 @@ def call_wav2lip(video_path, audio_path, output_path):
|
|
82 |
"--outfile", output_path,
|
83 |
]
|
84 |
|
85 |
-
|
|
|
|
|
|
|
86 |
return output_path
|
87 |
|
88 |
|
|
|
1 |
import os
|
2 |
+
import subprocess
|
3 |
import time
|
4 |
+
from datetime import datetime
|
5 |
+
|
6 |
import cv2
|
7 |
from flask import Flask, request, jsonify, send_file
|
8 |
from flask_ngrok2 import run_with_ngrok
|
|
|
75 |
# --face {inputVideoPath} \
|
76 |
# --audio {inputAudioPath} \
|
77 |
# --outfile {lipSyncedOutputPath}
|
78 |
+
start = datetime.now()
|
79 |
cmd = [
|
80 |
"python",
|
81 |
"wav2lip/inference.py",
|
|
|
86 |
"--outfile", output_path,
|
87 |
]
|
88 |
|
89 |
+
proc = subprocess.Popen(cmd, shell=False)
|
90 |
+
proc.communicate()
|
91 |
+
duration = datetime.now() - start
|
92 |
+
print(f'wav2lip finished in {duration}')
|
93 |
return output_path
|
94 |
|
95 |
|