Spaces:
Runtime error
Runtime error
Fix Docker implementation: Upload Dockerfile for real-time WebSocket STT streaming
Browse files- Dockerfile +3 -18
Dockerfile
CHANGED
|
@@ -11,6 +11,8 @@ RUN apt-get update && apt-get install -y \
|
|
| 11 |
libsndfile1 \
|
| 12 |
git \
|
| 13 |
curl \
|
|
|
|
|
|
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
# Create app directory and model cache directory
|
|
@@ -24,23 +26,6 @@ COPY requirements.txt .
|
|
| 24 |
RUN pip install --no-cache-dir --upgrade pip
|
| 25 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 26 |
|
| 27 |
-
# Pre-download and cache the model during build
|
| 28 |
-
RUN python -c "
|
| 29 |
-
import os
|
| 30 |
-
os.environ['TRANSFORMERS_CACHE'] = '/app/model_cache'
|
| 31 |
-
os.environ['HF_HOME'] = '/app/model_cache'
|
| 32 |
-
|
| 33 |
-
from transformers import KyutaiSpeechToTextProcessor, KyutaiSpeechToTextForConditionalGeneration
|
| 34 |
-
print('Downloading and caching model...')
|
| 35 |
-
|
| 36 |
-
model_id = 'kyutai/stt-1b-en_fr'
|
| 37 |
-
processor = KyutaiSpeechToTextProcessor.from_pretrained(model_id, cache_dir='/app/model_cache')
|
| 38 |
-
model = KyutaiSpeechToTextForConditionalGeneration.from_pretrained(model_id, cache_dir='/app/model_cache')
|
| 39 |
-
|
| 40 |
-
print('Model cached successfully at /app/model_cache')
|
| 41 |
-
print('Processor cached successfully')
|
| 42 |
-
"
|
| 43 |
-
|
| 44 |
# Copy application files
|
| 45 |
COPY app.py .
|
| 46 |
|
|
@@ -51,7 +36,7 @@ RUN chmod -R 755 /app/model_cache
|
|
| 51 |
EXPOSE 7860
|
| 52 |
|
| 53 |
# Health check
|
| 54 |
-
HEALTHCHECK --interval=30s --timeout=10s --start-period=
|
| 55 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 56 |
|
| 57 |
# Run the application
|
|
|
|
| 11 |
libsndfile1 \
|
| 12 |
git \
|
| 13 |
curl \
|
| 14 |
+
gcc \
|
| 15 |
+
g++ \
|
| 16 |
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
|
| 18 |
# Create app directory and model cache directory
|
|
|
|
| 26 |
RUN pip install --no-cache-dir --upgrade pip
|
| 27 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
# Copy application files
|
| 30 |
COPY app.py .
|
| 31 |
|
|
|
|
| 36 |
EXPOSE 7860
|
| 37 |
|
| 38 |
# Health check
|
| 39 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
|
| 40 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 41 |
|
| 42 |
# Run the application
|