Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
7c7c7c9
1
Parent(s):
64ec997
fix device
Browse files- detect_faces.py +3 -1
detect_faces.py
CHANGED
@@ -3,6 +3,7 @@ import os
|
|
3 |
import requests
|
4 |
from PIL import Image
|
5 |
from functools import lru_cache
|
|
|
6 |
|
7 |
MODEL_LINK = (
|
8 |
"https://github.com/akanametov/yolov8-face/releases/download/v0.0.0/yolov8l-face.pt"
|
@@ -20,7 +21,8 @@ def check_and_download_model():
|
|
20 |
|
21 |
|
22 |
model = YOLO(check_and_download_model())
|
23 |
-
|
|
|
24 |
|
25 |
|
26 |
def adjust_box(b, image_shape, margin=10):
|
|
|
3 |
import requests
|
4 |
from PIL import Image
|
5 |
from functools import lru_cache
|
6 |
+
import torch
|
7 |
|
8 |
MODEL_LINK = (
|
9 |
"https://github.com/akanametov/yolov8-face/releases/download/v0.0.0/yolov8l-face.pt"
|
|
|
21 |
|
22 |
|
23 |
model = YOLO(check_and_download_model())
|
24 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
25 |
+
model.to(device)
|
26 |
|
27 |
|
28 |
def adjust_box(b, image_shape, margin=10):
|