Spaces:
Configuration error
Configuration error
Commit
·
3b2ba8f
1
Parent(s):
f0d8178
Update app
Browse files- app.py +2 -0
- preprocess/inference_preprocess.py +2 -1
app.py
CHANGED
@@ -1026,6 +1026,8 @@ def process_video_syncoffset(video_path, num_avg_frames, apply_preprocess):
|
|
1026 |
except Exception as e:
|
1027 |
return None, f"Error: {str(e)}"
|
1028 |
|
|
|
|
|
1029 |
def process_video_activespeaker(video_path, global_speaker, num_avg_frames):
|
1030 |
try:
|
1031 |
# Extract the video filename
|
|
|
1026 |
except Exception as e:
|
1027 |
return None, f"Error: {str(e)}"
|
1028 |
|
1029 |
+
|
1030 |
+
@spaces.GPU(duration=300)
|
1031 |
def process_video_activespeaker(video_path, global_speaker, num_avg_frames):
|
1032 |
try:
|
1033 |
# Extract the video filename
|
preprocess/inference_preprocess.py
CHANGED
@@ -33,6 +33,7 @@ parser.add_argument('--work_root', type=str, required=True, help='Path to save m
|
|
33 |
parser.add_argument('--data_root', type=str, required=True, help='Directory containing ONLY full uncropped videos')
|
34 |
opt = parser.parse_args()
|
35 |
|
|
|
36 |
|
37 |
def bb_intersection_over_union(boxA, boxB):
|
38 |
xA = max(boxA[0], boxB[0])
|
@@ -184,7 +185,7 @@ def inference_video(opt, padding=0):
|
|
184 |
image_np = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
185 |
|
186 |
# Perform person detection
|
187 |
-
results = yolo_model(image_np, verbose=False)
|
188 |
detections = results[0].boxes
|
189 |
|
190 |
dets.append([])
|
|
|
33 |
parser.add_argument('--data_root', type=str, required=True, help='Directory containing ONLY full uncropped videos')
|
34 |
opt = parser.parse_args()
|
35 |
|
36 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
37 |
|
38 |
def bb_intersection_over_union(boxA, boxB):
|
39 |
xA = max(boxA[0], boxB[0])
|
|
|
185 |
image_np = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
186 |
|
187 |
# Perform person detection
|
188 |
+
results = yolo_model(image_np.to(device), verbose=False)
|
189 |
detections = results[0].boxes
|
190 |
|
191 |
dets.append([])
|