Update app.py
Browse files
app.py
CHANGED
@@ -192,9 +192,9 @@ def main(args):
|
|
192 |
|
193 |
face_path = temp_file_path
|
194 |
audio_path = new_audio_path
|
195 |
-
|
196 |
-
|
197 |
-
output_path =
|
198 |
|
199 |
# Call the function
|
200 |
inference_function.video_lipsync_correctness(
|
@@ -214,13 +214,19 @@ def main(args):
|
|
214 |
|
215 |
print('The video is generated')
|
216 |
|
217 |
-
|
|
|
|
|
|
|
|
|
|
|
218 |
duration = video_clip.duration
|
219 |
|
220 |
-
app.config['temp_response'] =
|
221 |
-
app.config['final_video_path'] =
|
222 |
app.config['final_video_duration'] = duration
|
223 |
-
|
|
|
224 |
|
225 |
# shutil.move(result, save_dir+'.mp4')
|
226 |
|
|
|
192 |
|
193 |
face_path = temp_file_path
|
194 |
audio_path = new_audio_path
|
195 |
+
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.mp4')
|
196 |
+
video_lipsync_file_path = temp_file.name
|
197 |
+
output_path = video_lipsync_file_path
|
198 |
|
199 |
# Call the function
|
200 |
inference_function.video_lipsync_correctness(
|
|
|
214 |
|
215 |
print('The video is generated')
|
216 |
|
217 |
+
with open(output_path, 'rb') as f:
|
218 |
+
video_content = f.read()
|
219 |
+
|
220 |
+
base64_lipsync_video = base64.b64encode(video_content).decode('utf-8')
|
221 |
+
|
222 |
+
video_clip = mp.VideoFileClip(output_path)
|
223 |
duration = video_clip.duration
|
224 |
|
225 |
+
app.config['temp_response'] = base64_lipsync_video
|
226 |
+
app.config['final_video_path'] = output_path
|
227 |
app.config['final_video_duration'] = duration
|
228 |
+
|
229 |
+
return base64_lipsync_video, output_path, duration
|
230 |
|
231 |
# shutil.move(result, save_dir+'.mp4')
|
232 |
|