File size: 1,242 Bytes
2986566
 
 
 
 
 
ca02259
2986566
 
 
 
01c6383
2986566
 
 
 
 
 
ca24438
 
 
b55f886
 
 
2986566
 
01c6383
2986566
ca02259
 
2986566
 
 
 
01c6383
 
 
 
 
 
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
# Use an official Python runtime as a parent image
FROM python:3.9-slim

# Set environment variables for Hugging Face cache
ENV TRANSFORMERS_CACHE=/app/.cache
ENV HF_DATASETS_CACHE=/app/.cache

# Create the cache directory
RUN mkdir -p /app/.cache

# Set the working directory in the container
WORKDIR /app

# Install system dependencies (required for soundfile and other libraries)
RUN apt-get update && apt-get install -y \
    libsndfile1 \
    && rm -rf /var/lib/apt/lists/*

# Copy the requirements file into the container
COPY requirements.txt .

# Upgrade pip to the latest version
RUN pip install --upgrade pip

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the current directory contents into the container
COPY . .

# Pre-download the Whisper model during the build process
RUN python -c "from transformers import WhisperProcessor, WhisperForConditionalGeneration; \
    WhisperProcessor.from_pretrained('openai/whisper-large-v3', cache_dir='/app/.cache'); \
    WhisperForConditionalGeneration.from_pretrained('openai/whisper-large-v3', cache_dir='/app/.cache')"

# Expose port 7860 (default port for Gradio)
EXPOSE 7860

# Run the app when the container launches
CMD ["python", "app.py"]