File size: 2,053 Bytes
560415a
 
1046847
 
 
 
560415a
1046847
560415a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1046847
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
62
63
64
65
FROM python:3.10-slim

# Install system dependencies:
#   ffmpeg          → required by ctc-forced-aligner
#   build-essential → compilers (g++, make) for the C++ extension
#   git             → needed to pip install from GitHub
RUN apt-get update && \
    apt-get install -y ffmpeg build-essential git && \
    rm -rf /var/lib/apt/lists/*

# ----- Redirect all caches to /tmp (mandatory for HF Spaces) -----
ENV NUMBA_CACHE_DIR=/tmp/numba_cache
ENV MPLCONFIGDIR=/tmp/matplotlib_cache
ENV XDG_CACHE_HOME=/tmp/xdg_cache
ENV HF_HOME=/tmp/hf_cache
ENV TRANSFORMERS_CACHE=/tmp/hf_cache/transformers
ENV TORCH_HOME=/tmp/hf_cache/torch
ENV HF_HUB_CACHE=/tmp/hf_cache/hub

RUN mkdir -p ${TRANSFORMERS_CACHE} ${TORCH_HOME} && \
    chmod -R 777 /tmp/hf_cache

WORKDIR /code

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 7860

# Adjust the module name if your Python file is named app.py (app:app)
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]FROM python:3.10-slim

# Install system dependencies:
#   ffmpeg          → required by ctc-forced-aligner
#   build-essential → compilers (g++, make) for the C++ extension
#   git             → needed to pip install from GitHub
RUN apt-get update && \
    apt-get install -y ffmpeg build-essential git && \
    rm -rf /var/lib/apt/lists/*

# ----- Redirect all caches to /tmp (mandatory for HF Spaces) -----
ENV NUMBA_CACHE_DIR=/tmp/numba_cache
ENV MPLCONFIGDIR=/tmp/matplotlib_cache
ENV XDG_CACHE_HOME=/tmp/xdg_cache
ENV HF_HOME=/tmp/hf_cache
ENV TRANSFORMERS_CACHE=/tmp/hf_cache/transformers
ENV TORCH_HOME=/tmp/hf_cache/torch
ENV HF_HUB_CACHE=/tmp/hf_cache/hub

RUN mkdir -p ${TRANSFORMERS_CACHE} ${TORCH_HOME} && \
    chmod -R 777 /tmp/hf_cache

WORKDIR /code

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 7860

# Adjust the module name if your Python file is named app.py (app:app)
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]