Update Dockerfile
Browse files- Dockerfile +1 -41
Dockerfile
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
-
# System dependencies
|
| 4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
ffmpeg \
|
| 6 |
git \
|
|
@@ -8,50 +7,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 8 |
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
-
# Install dependencies
|
| 12 |
COPY requirements.txt .
|
| 13 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
|
| 15 |
-
# Copy application code
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
-
# Pre-download all models at build time using snapshot_download
|
| 19 |
-
# HF_TOKEN must be set as a build secret or Space secret
|
| 20 |
-
ARG HF_TOKEN
|
| 21 |
-
ENV HF_TOKEN=${HF_TOKEN}
|
| 22 |
-
|
| 23 |
-
RUN python - <<'EOF'
|
| 24 |
-
import os
|
| 25 |
-
from huggingface_hub import snapshot_download, login
|
| 26 |
-
|
| 27 |
-
token = os.environ.get("HF_TOKEN", "")
|
| 28 |
-
if token:
|
| 29 |
-
login(token=token)
|
| 30 |
-
|
| 31 |
-
models = [
|
| 32 |
-
"drrobot9/wav2vec2-nigerian-language-identifier-v8",
|
| 33 |
-
"NCAIR1/Yoruba-ASR",
|
| 34 |
-
"NCAIR1/Igbo-ASR",
|
| 35 |
-
"NCAIR1/Hausa-ASR",
|
| 36 |
-
"NCAIR1/NigerianAccentedEnglish",
|
| 37 |
-
"NCAIR1/N-ATLaS",
|
| 38 |
-
]
|
| 39 |
-
|
| 40 |
-
for model_id in models:
|
| 41 |
-
print(f"Downloading {model_id}...")
|
| 42 |
-
snapshot_download(
|
| 43 |
-
repo_id=model_id,
|
| 44 |
-
token=token,
|
| 45 |
-
ignore_patterns=["*.msgpack", "*.h5", "flax_model*", "tf_model*",
|
| 46 |
-
"rust_model*", "optimizer.pt", "rng_state*",
|
| 47 |
-
"training_args.bin", "trainer_state.json",
|
| 48 |
-
"scheduler.pt"],
|
| 49 |
-
)
|
| 50 |
-
print(f" Done: {model_id}")
|
| 51 |
-
|
| 52 |
-
print("All models downloaded.")
|
| 53 |
-
EOF
|
| 54 |
-
|
| 55 |
EXPOSE 7860
|
| 56 |
|
| 57 |
-
CMD ["
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
|
|
|
| 3 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 4 |
ffmpeg \
|
| 5 |
git \
|
|
|
|
| 7 |
|
| 8 |
WORKDIR /app
|
| 9 |
|
|
|
|
| 10 |
COPY requirements.txt .
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
|
|
|
| 13 |
COPY . .
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
EXPOSE 7860
|
| 16 |
|
| 17 |
+
CMD ["python", "start.py"]
|