Spaces:
Running
Running
File size: 1,769 Bytes
fc7b4a9 e1ee8d1 fc7b4a9 e1ee8d1 fc7b4a9 a71ea0b 11885f3 a71ea0b fc7b4a9 8074d06 11885f3 ac7f5b3 54f0d32 61f21af fc7b4a9 769cf16 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# Use CUDA base for GPU support
FROM nvidia/cuda:13.0.1-runtime-ubuntu22.04
# Set timezone non-interactively
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
# Install Python and basic dependencies
RUN apt-get update && apt-get install -y \
software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update && apt-get install -y \
python3.11 \
python3.11-dev \
python3.11-venv \
python3.11-distutils \
git \
libsndfile1 \
ffmpeg \
curl \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /usr/bin/python3.11 /usr/bin/python3 \
&& ln -sf /usr/bin/python3.11 /usr/bin/python \
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11
WORKDIR /app
# Copy and install Python dependencies
COPY pyproject.toml poetry.lock* ./
RUN python3.11 -m pip install poetry && \
poetry config virtualenvs.create false && \
poetry install --only=main
# Copy application code
COPY models/ ./models/
COPY config/ ./config/
COPY app/ ./app/
COPY scripts/ ./scripts/
COPY src/ ./src/
# Create cache directories with proper permissions
RUN mkdir -p /app/.cache/huggingface /app/.cache/torch /tmp/numba_cache && \
chmod -R 777 /app/.cache /tmp/numba_cache
# Set environment
ENV PYTHONPATH="/app"
ENV HF_HOME="/app/.cache/huggingface"
ENV TRANSFORMERS_CACHE="/app/.cache/huggingface"
ENV TORCH_HOME="/app/.cache/torch"
ENV NUMBA_CACHE_DIR="/tmp/numba_cache"
ENV NUMBA_DISABLE_JIT=0
ENV MUSICLIME_NUM_SAMPLES=1000
ENV MUSICLIME_NUM_FEATURES=10
ENV PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
# Hugging Face Spaces specific, expose port 7860
EXPOSE 7860
# Run on port 7860 for HF Spaces
CMD ["uvicorn", "app.server:app", "--host", "0.0.0.0", "--port", "7860", "--timeout-keep-alive", "600"]
|