Spaces:
Runtime error
Runtime error
roychao19477
commited on
Commit
·
da43b5a
1
Parent(s):
b478c0f
Upload to debug
Browse files
app.py
CHANGED
|
@@ -75,6 +75,13 @@ import spaces
|
|
| 75 |
# Load model once globally
|
| 76 |
#ckpt_path = "ckpts/ep215_0906.oat.ckpt"
|
| 77 |
#model = AVSEModule.load_from_checkpoint(ckpt_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
CHUNK_SIZE_AUDIO = 2 * 48000 # 3 sec at 16kHz
|
| 79 |
CHUNK_SIZE_VIDEO = 2 * 75 # 25fps × 3 sec
|
| 80 |
|
|
@@ -159,15 +166,7 @@ def extract_resampled_audio(video_path, target_sr=16000):
|
|
| 159 |
def yolo_detection(frame, verbose=False):
|
| 160 |
return model(frame, verbose=verbose)[0]
|
| 161 |
|
| 162 |
-
@spaces.GPU
|
| 163 |
def extract_faces(video_file):
|
| 164 |
-
avse_model = AVSEModule()
|
| 165 |
-
#avse_state_dict = torch.load("ckpts/ep215_0906.oat.ckpt")
|
| 166 |
-
avse_state_dict = torch.load("ckpts/ep220_0908.oat.ckpt")
|
| 167 |
-
avse_model.load_state_dict(avse_state_dict, strict=True)
|
| 168 |
-
avse_model.to("cuda")
|
| 169 |
-
avse_model.eval()
|
| 170 |
-
|
| 171 |
cap = cv2.VideoCapture(video_file)
|
| 172 |
fps = cap.get(cv2.CAP_PROP_FPS)
|
| 173 |
frames = []
|
|
|
|
| 75 |
# Load model once globally
|
| 76 |
#ckpt_path = "ckpts/ep215_0906.oat.ckpt"
|
| 77 |
#model = AVSEModule.load_from_checkpoint(ckpt_path)
|
| 78 |
+
avse_model = AVSEModule()
|
| 79 |
+
#avse_state_dict = torch.load("ckpts/ep215_0906.oat.ckpt")
|
| 80 |
+
avse_state_dict = torch.load("ckpts/ep220_0908.oat.ckpt")
|
| 81 |
+
avse_model.load_state_dict(avse_state_dict, strict=True)
|
| 82 |
+
avse_model.to("cuda")
|
| 83 |
+
avse_model.eval()
|
| 84 |
+
|
| 85 |
CHUNK_SIZE_AUDIO = 2 * 48000 # 3 sec at 16kHz
|
| 86 |
CHUNK_SIZE_VIDEO = 2 * 75 # 25fps × 3 sec
|
| 87 |
|
|
|
|
| 166 |
def yolo_detection(frame, verbose=False):
|
| 167 |
return model(frame, verbose=verbose)[0]
|
| 168 |
|
|
|
|
| 169 |
def extract_faces(video_file):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
cap = cv2.VideoCapture(video_file)
|
| 171 |
fps = cap.get(cv2.CAP_PROP_FPS)
|
| 172 |
frames = []
|