Spaces:
Sleeping
Sleeping
| # CardioScreen AI — Hugging Face Spaces Dockerfile | |
| # HF Spaces runs on port 7860 by default | |
| FROM python:3.11-slim | |
| # System deps: libsndfile for soundfile, ffmpeg for librosa audio decoding | |
| RUN apt-get update && apt-get install -y \ | |
| libsndfile1 \ | |
| ffmpeg \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Install CPU-only PyTorch + torchvision (~400MB vs ~4GB CUDA build) | |
| RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu | |
| # Install remaining Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy API + inference files | |
| COPY api.py . | |
| COPY inference.py . | |
| COPY model_params.json . | |
| # CNN weights downloaded at runtime by inference.py via huggingface_hub | |
| # (Xet storage prevents COPY during Docker build) | |
| # HF Spaces uses port 7860 | |
| EXPOSE 7860 | |
| ENV PORT=7860 | |
| CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"] | |