Giddycrypt commited on
Commit
ab46ed3
·
verified ·
1 Parent(s): 56ae5af

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
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="WildChlamydia/MiVOLO_D1",
48
  filename="yolov8x_person_face.pt"
49
  )
50
 
51
- # Download the MiVOLO age+gender estimator weights
52
- checkpoint = hf_hub_download(
53
- repo_id="WildChlamydia/MiVOLO_D1",
54
- filename="mivolo_d1_age_gender.pth.tar"
55
- )
56
 
57
  # Build MiVOLO config
58
  config = argparse.Namespace(
59
  detector_weights=detector_weights,
60
- checkpoint=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