Spaces:
Running
Running
Upload 2 files
Browse files- Dockerfile +1 -1
- 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
|
| 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
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
| 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(
|