File size: 1,582 Bytes
6ef63ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.10-slim

# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    ffmpeg \
    libsndfile1 \
    libportaudio2 \
    git \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install torch CPU first (before anything else)
RUN pip install --no-cache-dir torch==2.1.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cpu

# Clone Applio for RVC inference
RUN git clone --depth 1 https://github.com/IAHispano/Applio.git /app/applio

# Remove torch pin from Applio requirements (we already have torch)
RUN cd /app/applio && sed -i '/^torch/d' requirements.txt

# Install Applio requirements
RUN cd /app/applio && pip install --no-cache-dir -r requirements.txt || true

# Ensure critical packages are installed
RUN pip install --no-cache-dir \
    numpy==1.24.3 \
    faiss-cpu \
    torchcrepe \
    torchfcpe \
    praat-parselmouth \
    pyworld \
    fairseq==0.12.2 \
    huggingface_hub \
    edge-tts \
    gradio==4.44.1 \
    soundfile \
    librosa

# Download Applio prerequisites (pretrained models for inference)
RUN cd /app/applio && python core.py prerequisites || true

COPY app.py /app/app.py

# Create a non-root user
RUN useradd -m -u 1000 user

# Give user write access to temp and model dirs
RUN mkdir -p /app/temp /app/models && chown -R user:user /app/temp /app/models /app/applio/logs

USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    GRADIO_SERVER_NAME=0.0.0.0 \
    PYTHONPATH=/app/applio:/app/applio/rvc/train

EXPOSE 7860
CMD ["python", "app.py"]