File size: 1,300 Bytes
19a7ff4
2916460
fd7c103
2916460
 
fd7c103
 
 
 
2916460
 
 
ae8efe3
 
 
 
 
2916460
 
 
 
 
 
 
 
0487660
 
 
 
2916460
 
 
0487660
 
 
 
 
2916460
 
 
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
FROM python:3.9-slim

# Install system dependencies including build tools for compiling packages
RUN apt-get update && apt-get install -y \
    git \
    build-essential \
    gcc \
    g++ \
    make \
    && rm -rf /var/lib/apt/lists/*

# Install torch 2.4.1 first (required for xcodec2)
# Try installing from PyPI directly (may work with Python 3.9 despite version warning)
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir torch==2.4.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 || \
    (echo "torch 2.4.1 failed, trying 2.3.1..." && \
     pip install --no-cache-dir torch==2.3.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121)

# Copy requirements and install
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt

# Copy app
COPY app.py /app/app.py

# Copy examples directory (create examples/ folder in your Space with default audio files)
# If examples/ doesn't exist, this will fail - create the folder and add your WAV files
COPY examples/ /app/examples/

# Set working directory
WORKDIR /app

# Set environment variables for optimal performance
ENV OMP_NUM_THREADS=1
ENV MKL_NUM_THREADS=1
ENV NUMEXPR_NUM_THREADS=1

# Run app
CMD ["python", "app.py"]