Spaces:
Sleeping
Sleeping
File size: 2,864 Bytes
1d4a5a2 b1f8065 1d4a5a2 b1f8065 1d4a5a2 b1f8065 1d4a5a2 2c3f1fb 1d4a5a2 2c3f1fb 1d4a5a2 5e8530b 2c3f1fb 5e8530b 1d4a5a2 5e8530b 1d4a5a2 b1f8065 1d4a5a2 1a4b93d ec87f2b 1d4a5a2 b1f8065 1a4b93d | 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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# OpenEnv Creative Auctioneer β Docker Image
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Build:
# docker build -t openenv-auctioneer .
#
# Run (FastAPI server β default, used by inference.py & HF Space):
# docker run --rm -p 7860:7860 openenv-auctioneer
#
# Run (inference agent directly):
# docker run --rm -e HF_TOKEN=<key> openenv-auctioneer python inference.py
#
# Run (single task):
# docker run --rm -e HF_TOKEN=<key> -e AUCTIONEER_TASK=easy_headline openenv-auctioneer python inference.py
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
FROM python:3.10-slim
# System deps for torch / sentence-transformers
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Upgrade pip first β old pip (23.0.1) has poor retry / resume support
RUN pip install --upgrade pip
# Install torch CPU separately (largest download, benefits from its own cached layer)
RUN pip install --default-timeout=1000 --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
# Install remaining Python dependencies (layer-cached)
COPY requirements.txt .
RUN pip install --default-timeout=1000 --no-cache-dir -r requirements.txt
# Pre-download the SentenceTransformer model so the container is self-contained
RUN python -c 'from sentence_transformers import SentenceTransformer; SentenceTransformer("all-MiniLM-L6-v2"); print("SentenceTransformer cached β")'
# Copy source files
COPY models.py environment.py inference.py app.py openenv.yaml ./
# Download the zip file directly (requires a direct download URL, not a folder sharing link)
# Download dataset using gdown (RELIABLE)
RUN apt-get update && apt-get install -y unzip && \
pip install --no-cache-dir gdown && \
gdown https://drive.google.com/uc?id=1-L8LCTSjjQs9qFdnIzFdnf0J37Yf6cxm -O Datasets.zip && \
unzip Datasets.zip -d ./ && \
rm Datasets.zip && \
rm -rf /var/lib/apt/lists/*
# Environment variable defaults (DATA_DIR removed so it falls back to the local folder)
ENV TASK=all \
USE_LLM_SIMULATOR=0
EXPOSE 7860
# Default: run the FastAPI server (used by inference.py and HF Space)
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |