Giddycrypt commited on
Commit
20083da
·
verified ·
1 Parent(s): cc87b5c

Upload 2 files

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. app.py +6 -4
Dockerfile CHANGED
@@ -21,7 +21,7 @@ RUN pip install --no-cache-dir -r requirements.txt
21
 
22
  # Copy our API entrypoint and the uploaded checkpoint file
23
  COPY app.py .
24
- COPY model_imdb_cross_person_4.24_99.46.pth.tar .
25
 
26
  # Hugging Face Spaces use port 7860
27
  EXPOSE 7860
 
21
 
22
  # Copy our API entrypoint and the uploaded checkpoint file
23
  COPY app.py .
24
+ COPY *.pth.tar ./
25
 
26
  # Hugging Face Spaces use port 7860
27
  EXPOSE 7860
app.py CHANGED
@@ -49,10 +49,12 @@ def get_predictor():
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.24_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(
 
49
  )
50
 
51
  # The age/gender checkpoint is no longer publicly hosted on HF.
52
+ # We auto-detect any .pth.tar file uploaded to the Space.
53
+ import glob
54
+ checkpoint_files = glob.glob("*.pth.tar")
55
+ if not checkpoint_files:
56
+ raise FileNotFoundError("No checkpoint file ending in .pth.tar found in Space root! Please upload it.")
57
+ checkpoint_path = checkpoint_files[0]
58
 
59
  # Build MiVOLO config
60
  config = argparse.Namespace(