File size: 1,250 Bytes
1e7f09a
 
 
 
 
 
 
 
 
 
 
 
 
15a1f73
 
 
 
 
 
1e7f09a
 
 
 
 
b75abdd
1e7f09a
 
 
15a1f73
b75abdd
1e7f09a
15a1f73
1e7f09a
15a1f73
 
1e7f09a
15a1f73
 
1e7f09a
 
15a1f73
 
 
 
 
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
FROM python:3.10-slim


# Set environment variables to avoid caching issues
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    TRANSFORMERS_CACHE=/app/.hf_cache \
    HF_HOME=/app/.hf_cache \
    TORCH_HOME=/app/.hf_cache \
    TMPDIR=/app/temp_files

# Set the working directory
WORKDIR /app

RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    libsndfile1 \
    && rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y \
    ffmpeg \
    git \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Create necessary directories with appropriate permissions
RUN mkdir -p /app/temp_files /app/.hf_cache && \
    chmod -R 777 /app/temp_files /app/.hf_cache


# Copy requirement file and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code
COPY . .

# Ensure app folder and subfolders are fully accessible
RUN chmod -R 777 /app

# Expose the port that your Flask application will listen on.
# Hugging Face Spaces typically expects applications to listen on port 7860.
EXPOSE 7860
CMD ["python", "-m", "gunicorn", "-w", "1", "--bind", "0.0.0.0:7860", "app:app"]