FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 \ HF_HOME=/tmp/huggingface \ TRANSFORMERS_CACHE=/tmp/huggingface/transformers \ HF_HUB_CACHE=/tmp/huggingface/hub RUN apt-get update && apt-get install -y python3 python3-pip git && rm -rf /var/lib/apt/lists/* WORKDIR /app # Create writable cache directories for HuggingFace RUN mkdir -p /tmp/huggingface && chmod -R 777 /tmp/huggingface COPY requirements.txt /app/ RUN python3 -m pip install --upgrade pip && pip3 install -r requirements.txt COPY app.py /app/ # Spaces exposes the app on $PORT ENV PORT=7860 EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]