Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +24 -0
Dockerfile
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
|
| 3 |
+
ENV PYTHONUNBUFFERED=1 \
|
| 4 |
+
PIP_NO_CACHE_DIR=1 \
|
| 5 |
+
HF_HOME=/app/.cache/huggingface \
|
| 6 |
+
TRANSFORMERS_CACHE=/app/.cache/huggingface/transformers
|
| 7 |
+
|
| 8 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 9 |
+
git && rm -rf /var/lib/apt/lists/*
|
| 10 |
+
|
| 11 |
+
WORKDIR /app
|
| 12 |
+
COPY requirements.txt /app/requirements.txt
|
| 13 |
+
|
| 14 |
+
# Install CPU torch first from the PyTorch index, then the rest
|
| 15 |
+
RUN pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu torch==2.3.1+cpu \
|
| 16 |
+
&& pip install --no-cache-dir -r /app/requirements.txt
|
| 17 |
+
|
| 18 |
+
COPY main.py /app/main.py
|
| 19 |
+
|
| 20 |
+
EXPOSE 7860
|
| 21 |
+
ENV MODEL_ID="ethnmcl/checkin-gpt2"
|
| 22 |
+
# If private model, set HF_TOKEN as a Space secret
|
| 23 |
+
|
| 24 |
+
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|