Midnightar commited on
Commit
acc7904
·
verified ·
1 Parent(s): 5f8e73c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -3
Dockerfile CHANGED
@@ -8,19 +8,22 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
8
 
9
  WORKDIR /app
10
 
 
 
 
11
  # Copy requirements first
12
  COPY requirements.txt .
13
  RUN pip install --no-cache-dir -r requirements.txt
14
 
15
  # Pre-cache Hugging Face models (avoid cold starts)
16
  RUN python -c "from transformers import Wav2Vec2Processor, AutoModelForAudioClassification; \
17
- Wav2Vec2Processor.from_pretrained('facebook/wav2vec2-base-960h'); \
18
- AutoModelForAudioClassification.from_pretrained('prithivMLmods/Common-Voice-Gender-Detection')"
19
 
20
  # Copy app
21
  COPY app.py .
22
 
23
- # Expose the port Hugging Face uses (default: 7860)
24
  EXPOSE 7860
25
 
26
  # Run uvicorn, binding to $PORT injected by Hugging Face
 
8
 
9
  WORKDIR /app
10
 
11
+ # Set Hugging Face cache to a writable directory
12
+ ENV HF_HOME=/app/hf_cache
13
+
14
  # Copy requirements first
15
  COPY requirements.txt .
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
18
  # Pre-cache Hugging Face models (avoid cold starts)
19
  RUN python -c "from transformers import Wav2Vec2Processor, AutoModelForAudioClassification; \
20
+ Wav2Vec2Processor.from_pretrained('facebook/wav2vec2-base-960h', cache_dir='/app/hf_cache'); \
21
+ AutoModelForAudioClassification.from_pretrained('prithivMLmods/Common-Voice-Gender-Detection', cache_dir='/app/hf_cache')"
22
 
23
  # Copy app
24
  COPY app.py .
25
 
26
+ # Expose the port Hugging Face assigns (default 7860)
27
  EXPOSE 7860
28
 
29
  # Run uvicorn, binding to $PORT injected by Hugging Face