File size: 966 Bytes
5c7f7a6
 
 
 
 
 
 
 
 
 
 
 
 
571f0d6
 
ebd34d3
 
5c7f7a6
 
 
 
 
 
 
 
05a611f
 
5c7f7a6
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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"]