Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| WORKDIR /home/user | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| wget gnupg ca-certificates \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| RUN pip install --no-cache-dir playwright && \ | |
| mkdir -p /home/user/.cache/ms-playwright && \ | |
| PLAYWRIGHT_BROWSERS_PATH=/home/user/.cache/ms-playwright playwright install chromium --with-deps && \ | |
| rm -rf /var/lib/apt/lists/* | |
| ENV PORT=7860 | |
| ENV PLAYWRIGHT_BROWSERS_PATH=/home/user/.cache/ms-playwright | |
| ENV HF_HOME=/home/user/.cache/huggingface | |
| RUN chmod -R 755 /home/user | |
| RUN python -c "from transformers import AutoModelForImageSegmentation; AutoModelForImageSegmentation.from_pretrained('briaai/RMBG-1.4', trust_remote_code=True)" | |
| COPY . . | |
| EXPOSE 7860 | |
| CMD ["python", "-m", "hypercorn", "server:app", "-b", "0.0.0.0:7860", "--access-log", "-", "--error-log", "-", "--log-level", "info"] |