Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1 libglib2.0-0 libsm6 libxext6 libxrender-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| ENV TOKENIZERS_PARALLELISM=false | |
| WORKDIR /app | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir \ | |
| torch==2.4.0+cpu \ | |
| torchvision==0.19.0+cpu \ | |
| --index-url https://download.pytorch.org/whl/cpu \ | |
| && pip install --no-cache-dir -r requirements.txt \ | |
| && python -c "import torch, torchvision, transformers; from transformers.utils import is_torch_available, is_torchvision_available; assert is_torch_available(), 'torch not detected'; assert is_torchvision_available(), 'torchvision not detected'; print('OK torch', torch.__version__, 'transformers', transformers.__version__)" | |
| COPY --chown=user . . | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |