File size: 2,197 Bytes
087da0d
257a670
 
 
 
087da0d
 
 
257a670
 
 
9e08372
 
 
257a670
 
 
04d213f
 
 
 
 
 
087da0d
257a670
 
 
 
 
 
c1bb120
 
 
 
 
 
 
ce9bdb4
257a670
 
c1bb120
 
 
257a670
c1bb120
 
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
# Hugging Face Space (Docker SDK) — public LIVE demo of the UGC pipeline UI.
# The Space repo root holds this Dockerfile + requirements-demo.txt + README.md and
# the app dirs (pipeline/ migrations/ fixtures/).
FROM python:3.11-slim

# ffmpeg drives assembly (smart stitch + concat + loudnorm + captions);
# libgomp1 is the OpenMP runtime CTranslate2 (kb-whisper ASR) needs.
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg libgomp1 \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app
# CPU-only torch/torchaudio (for the SpeechBrain VoxLingua107 language gate). The CPU wheels
# keep the image far smaller than the default CUDA build; installed first so requirements reuse them.
RUN pip install --no-cache-dir torch torchaudio --index-url https://download.pytorch.org/whl/cpu
COPY requirements-demo.txt .
RUN pip install --no-cache-dir -r requirements-demo.txt

# faster-whisper (kb-whisper ASR for QC) is installed above. The model is deliberately
# NOT baked at build time: loading kb-whisper-large needs ~2 GB RAM and the cpu-basic
# BUILD container OOM-kills it (exit 137). It downloads lazily on the first QC at RUNTIME,
# where cpu-basic has 16 GB. HF_HOME gives that download a known, world-writable cache dir.
ENV HF_HOME=/app/.cache/huggingface
RUN mkdir -p /app/.cache/huggingface && chmod -R 777 /app/.cache

COPY pipeline ./pipeline
COPY migrations ./migrations
COPY fixtures ./fixtures
# MEDIA_DIR = /app/media (config.py); make it world-writable for the Space runtime.
RUN mkdir -p /app/media && chmod -R 777 /app/media

# Public LIVE demo: REAL Veo generation, hard-capped at MAX_GENERATIONS_PER_DAY/day
# (owner's call — open access). Points at the real `ugc` schema. Secrets on the Space:
# DATABASE_URL, ANTHROPIC_API_KEY, GOOGLE_CLOUD_PROJECT, VEO_MODEL_ID, VERTEX_LOCATION,
# GOOGLE_CREDENTIALS_JSON (the ADC json content).
ENV DRY_RUN=false \
    DB_SCHEMA=ugc \
    MAX_GENERATIONS_PER_DAY=400 \
    VEO_RAI_AUTORETRY=true \
    PYTHONUNBUFFERED=1

COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh

EXPOSE 7860
# entrypoint writes the Google ADC json from the secret (if set), migrates, then serves.
CMD ["/app/entrypoint.sh"]