Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +24 -10
Dockerfile
CHANGED
@@ -1,20 +1,34 @@
|
|
1 |
-
#
|
2 |
-
FROM python:3.9-slim
|
|
|
|
|
|
|
|
|
3 |
|
|
|
|
|
|
|
|
|
4 |
WORKDIR /app
|
|
|
|
|
5 |
COPY requirements.txt .
|
6 |
-
RUN pip install --no-cache-dir --user -r requirements.txt
|
7 |
|
8 |
-
#
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
# Copy
|
13 |
-
COPY --from=builder /root/.local /root/.local
|
14 |
COPY . .
|
15 |
|
16 |
-
#
|
17 |
-
|
|
|
|
|
18 |
|
19 |
# Expose port 7860 (default port for Gradio)
|
20 |
EXPOSE 7860
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.9-slim
|
3 |
+
|
4 |
+
# Set environment variables for Hugging Face cache
|
5 |
+
ENV TRANSFORMERS_CACHE=/app/.cache
|
6 |
+
ENV HF_DATASETS_CACHE=/app/.cache
|
7 |
|
8 |
+
# Create the cache directory
|
9 |
+
RUN mkdir -p /app/.cache
|
10 |
+
|
11 |
+
# Set the working directory in the container
|
12 |
WORKDIR /app
|
13 |
+
|
14 |
+
# Copy the requirements file into the container
|
15 |
COPY requirements.txt .
|
|
|
16 |
|
17 |
+
# Install system dependencies (required for soundfile and other libraries)
|
18 |
+
RUN apt-get update && apt-get install -y \
|
19 |
+
libsndfile1 \
|
20 |
+
&& rm -rf /var/lib/apt/lists/*
|
21 |
+
|
22 |
+
# Install Python dependencies
|
23 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
24 |
|
25 |
+
# Copy the current directory contents into the container
|
|
|
26 |
COPY . .
|
27 |
|
28 |
+
# Pre-download the Whisper model during the build process
|
29 |
+
RUN python -c "from transformers import WhisperProcessor, WhisperForConditionalGeneration; \
|
30 |
+
WhisperProcessor.from_pretrained('openai/whisper-large-v3', cache_dir='/app/.cache'); \
|
31 |
+
WhisperForConditionalGeneration.from_pretrained('openai/whisper-large-v3', cache_dir='/app/.cache')"
|
32 |
|
33 |
# Expose port 7860 (default port for Gradio)
|
34 |
EXPOSE 7860
|