File size: 1,218 Bytes
8c70a10
 
 
 
21dc720
ea05603
8c70a10
 
 
bf317f7
 
 
 
 
 
 
 
 
 
 
8c70a10
 
 
 
 
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
FROM python:3.10-slim

WORKDIR /app

ENV HF_HOME=/tmp/.cache

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

# Pre-download ASR model
RUN python -c "from transformers import AutoProcessor; from optimum.onnxruntime import ORTModelForSpeechSeq2Seq; AutoProcessor.from_pretrained('openai/whisper-base'); ORTModelForSpeechSeq2Seq.from_pretrained('openai/whisper-base', provider='CPUExecutionProvider')"

# Pre-download Translation models
RUN python -c "from transformers import pipeline; pipeline('translation', model='Helsinki-NLP/opus-mt-en-zh')"
RUN python -c "from transformers import pipeline; pipeline('translation', model='Helsinki-NLP/opus-mt-zh-en')"
RUN python -c "from transformers import pipeline; pipeline('translation', model='staka/fugumt-en-ja')"
RUN python -c "from transformers import pipeline; pipeline('translation', model='Helsinki-NLP/opus-mt-ja-en')"
RUN python -c "from transformers import pipeline; pipeline('translation', model='Helsinki-NLP/opus-mt-tc-big-en-ko')"
RUN python -c "from transformers import pipeline; pipeline('translation', model='Helsinki-NLP/opus-mt-ko-en')"

COPY . .

EXPOSE 7860

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]