CoolFace
Apppublic

dejanseo/reverse-prompter

sourceHugging Faceotherupdated 11d agoView on Hugging Face
0likes
Dockerfile41 linesDownload Raw Back to root
1FROM python:3.11-slim2 3# 1. Install OS build dependencies and curl4RUN apt-get update && apt-get install -y --no-install-recommends \5    build-essential \6    curl \7    git \8    && rm -rf /var/lib/apt/lists/*9 10# 2. Set up user 1000 (required by Hugging Face Spaces)11RUN useradd -m -u 1000 user12ENV HOME=/home/user \13    PATH=/home/user/.local/bin:$PATH \14    PYTHONUNBUFFERED=1 \15    HF_HOME=/home/user/.cache/huggingface16 17WORKDIR $HOME/app18 19# 3. Install Python dependencies as user20COPY --chown=user:user requirements.txt .21USER user22RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \23    pip install --no-cache-dir -r requirements.txt24 25# 4. Pre-download model & tokenizer into image layer so startup is instant26RUN python -c "from transformers import AutoModelForCausalLM, AutoTokenizer; \27    AutoModelForCausalLM.from_pretrained('dejanseo/reverse-prompter'); \28    AutoTokenizer.from_pretrained('dejanseo/reverse-prompter')"29 30# 5. Copy application source31COPY --chown=user:user . .32 33EXPOSE 786034 35# 6. Streamlit startup flags configured for HF Spaces iframe and port 786036CMD ["streamlit", "run", "src/streamlit_app.py", \37     "--server.port=7860", \38     "--server.address=0.0.0.0", \39     "--server.headless=true", \40     "--server.enableCORS=false", \41     "--server.enableXsrfProtection=false"]