Spaces:
Build error
Build error
FROM python:3.10-slim | |
# 1. Install OS and Python dependencies | |
RUN apt-get update \ | |
&& apt-get install -y build-essential curl git \ | |
&& pip install --upgrade pip \ | |
onnxruntime-genai==0.8.3 \ | |
gradio \ | |
huggingface_hub>=0.33.3 \ | |
numpy \ | |
&& rm -rf /var/lib/apt/lists/* | |
# 2. Download the ONNX model files at build time | |
RUN python - <<EOF | |
from huggingface_hub import snapshot_download | |
snapshot_download( | |
repo_id="microsoft/Phi-4-mini-reasoning-onnx", | |
subfolder="cpu_and_mobile/cpu-int4-rtn-block-32-acc-level-4", | |
repo_type="model", | |
local_dir="/phi4_model", | |
repo_type="model", | |
# restrict files to ONNX & config via allow_patterns | |
allow_patterns=["*.onnx", "*.json", "*.txt"] | |
) | |
EOF | |
# 3. Set working directory and copy application code | |
WORKDIR /app | |
COPY app.py ./app.py | |
# 4. Open port and set entrypoint | |
EXPOSE 7860 | |
CMD ["python", "app.py"] | |