# 3D Gaussian 4D Video Stack Visualizer — Hugging Face Docker Space FROM python:3.10-slim # ffmpeg gives OpenCV broad codec support for decoding uploaded videos. # (opencv-python-headless needs no X libraries, but ffmpeg helps with more formats.) RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # Hugging Face Spaces run as a non-root user (uid 1000). Create it and a home. RUN useradd -m -u 1000 user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PORT=7860 \ HOST=0.0.0.0 \ PYTHONUNBUFFERED=1 WORKDIR $HOME/app # Install Python deps first for better layer caching. COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -r requirements.txt # Copy the application (app.py, static/, video/). COPY --chown=user . . # Ensure runtime dirs exist and are owned by the runtime user. RUN mkdir -p uploads frames && chown -R user:user $HOME/app USER user EXPOSE 7860 # gunicorn: single worker (shared on-disk session dirs), several threads for # concurrent texture requests, generous timeout for large frame extractions. CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "8", \ "--timeout", "600", "app:app"]