Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
|
@@ -42,22 +42,22 @@ def get_predictor():
|
|
| 42 |
from huggingface_hub import hf_hub_download
|
| 43 |
from mivolo.predictor import Predictor
|
| 44 |
|
| 45 |
-
# Download the YOLOv8 person+face detector weights
|
| 46 |
detector_weights = hf_hub_download(
|
| 47 |
-
repo_id="
|
| 48 |
filename="yolov8x_person_face.pt"
|
| 49 |
)
|
| 50 |
|
| 51 |
-
#
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
|
| 57 |
# Build MiVOLO config
|
| 58 |
config = argparse.Namespace(
|
| 59 |
detector_weights=detector_weights,
|
| 60 |
-
checkpoint=
|
| 61 |
device="cpu",
|
| 62 |
with_persons=True, # Use full-body context for better accuracy
|
| 63 |
disable_faces=False, # Also use face features
|
|
|
|
| 42 |
from huggingface_hub import hf_hub_download
|
| 43 |
from mivolo.predictor import Predictor
|
| 44 |
|
| 45 |
+
# Download the YOLOv8 person+face detector weights from the public working repo
|
| 46 |
detector_weights = hf_hub_download(
|
| 47 |
+
repo_id="iitolstykh/demo_yolov8_detector",
|
| 48 |
filename="yolov8x_person_face.pt"
|
| 49 |
)
|
| 50 |
|
| 51 |
+
# The age/gender checkpoint is no longer publicly hosted on HF.
|
| 52 |
+
# We expect the user to have uploaded it directly to the HF Space.
|
| 53 |
+
checkpoint_path = "model_imdb_cross_person_4.22_99.46.pth.tar"
|
| 54 |
+
if not os.path.exists(checkpoint_path):
|
| 55 |
+
raise FileNotFoundError(f"Checkpoint {checkpoint_path} not found in Space root! Please upload it.")
|
| 56 |
|
| 57 |
# Build MiVOLO config
|
| 58 |
config = argparse.Namespace(
|
| 59 |
detector_weights=detector_weights,
|
| 60 |
+
checkpoint=checkpoint_path,
|
| 61 |
device="cpu",
|
| 62 |
with_persons=True, # Use full-body context for better accuracy
|
| 63 |
disable_faces=False, # Also use face features
|