Spaces:
Sleeping
Sleeping
roychao19477
commited on
Commit
·
14a8e2e
1
Parent(s):
bf9a993
Test on lengths
Browse files
app.py
CHANGED
|
@@ -72,6 +72,7 @@ from model import AVSEModule
|
|
| 72 |
from config import sampling_rate
|
| 73 |
import spaces
|
| 74 |
import time
|
|
|
|
| 75 |
|
| 76 |
# Load model once globally
|
| 77 |
#ckpt_path = "ckpts/ep215_0906.oat.ckpt"
|
|
@@ -252,6 +253,18 @@ def extract_faces(video_file):
|
|
| 252 |
|
| 253 |
enhanced_audio_path = run_avse_inference(output_path, audio_path)
|
| 254 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
|
| 256 |
return output_path, enhanced_audio_path
|
| 257 |
#return output_path, audio_path
|
|
|
|
| 72 |
from config import sampling_rate
|
| 73 |
import spaces
|
| 74 |
import time
|
| 75 |
+
import shutil
|
| 76 |
|
| 77 |
# Load model once globally
|
| 78 |
#ckpt_path = "ckpts/ep215_0906.oat.ckpt"
|
|
|
|
| 253 |
|
| 254 |
enhanced_audio_path = run_avse_inference(output_path, audio_path)
|
| 255 |
|
| 256 |
+
# For API:
|
| 257 |
+
static_dir = "./file_outputs"
|
| 258 |
+
os.makedirs(static_dir, exist_ok=True)
|
| 259 |
+
|
| 260 |
+
# Move/copy to static
|
| 261 |
+
face_video_out = os.path.join(static_dir, "face_only_video.mp4")
|
| 262 |
+
enhanced_audio_out = os.path.join(static_dir, "enhanced_audio.wav")
|
| 263 |
+
shutil.copy(output_path, face_video_out)
|
| 264 |
+
shutil.copy(enhanced_audio_path, enhanced_audio_out)
|
| 265 |
+
|
| 266 |
+
return face_video_out, enhanced_audio_out
|
| 267 |
+
|
| 268 |
|
| 269 |
return output_path, enhanced_audio_path
|
| 270 |
#return output_path, audio_path
|