File size: 866 Bytes
77b1831
 
 
 
9fccefa
77b1831
9fccefa
 
 
 
 
77b1831
 
 
 
9fccefa
77b1831
 
 
 
 
 
 
9fccefa
77b1831
 
9fccefa
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
FROM python:3.11-slim

ENV PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    HF_HOME=/data/huggingface

# Create a writable, persistent cache directory in Spaces
RUN mkdir -p /data/huggingface && chmod -R 777 /data

# (Optional) system tools
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY requirements.txt /app/requirements.txt

# Install CPU torch first (smaller, no CUDA), then the rest
RUN pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu torch==2.3.1+cpu \
 && pip install --no-cache-dir -r /app/requirements.txt

COPY main.py /app/main.py

EXPOSE 7860
ENV MODEL_ID="ethnmcl/checkin-gpt2"
# If the model repo is private, set a Space Secret named HF_TOKEN (Settings → Secrets)

CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]