| FROM python:3.10.12-slim |
|
|
| WORKDIR /app |
|
|
| |
| ENV HF_HOME=/app/.cache |
| ENV MPLCONFIGDIR=/app/.cache |
|
|
| |
| RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0 && apt-get clean |
|
|
| |
| RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache |
|
|
| |
| COPY requirements.txt . |
| RUN pip install --no-cache-dir -r requirements.txt |
|
|
| |
| RUN python -c "from transformers import SamModel, SamProcessor; \ |
| SamModel.from_pretrained('Zigeng/SlimSAM-uniform-50', cache_dir='/app/.cache'); \ |
| SamProcessor.from_pretrained('Zigeng/SlimSAM-uniform-50', cache_dir='/app/.cache')" |
|
|
| |
| COPY . . |
|
|
| |
| ENV PORT=7860 |
|
|
| |
| CMD ["gunicorn", "app:app", "--bind", "0.0.0.0:7860", "--workers", "2"] |
|
|