Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PORT=7860 | |
| WORKDIR /app | |
| # --- System dependencies (Optimized for WebRTC & CV) --- | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| pkg-config \ | |
| git \ | |
| ffmpeg \ | |
| libavdevice-dev libavfilter-dev libavformat-dev libavcodec-dev \ | |
| libswresample-dev libswscale-dev libavutil-dev \ | |
| libgl1 libglib2.0-0 \ | |
| # Speed trick: TCMalloc for better memory management in PyTorch | |
| libgoogle-perftools-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set TCMalloc as the memory allocator | |
| ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc.so.4" | |
| # --- Python Setup --- | |
| RUN python -m pip install --upgrade pip setuptools wheel | |
| # --- Dependencies --- | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY . . | |
| # Setup permissions | |
| RUN mkdir -p static/uploads static/results && chmod -R 777 static/uploads static/results | |
| EXPOSE 7860 | |
| CMD ["python", "-u", "app.py"] |