yellow60852 commited on
Commit
58f9f55
·
verified ·
1 Parent(s): 99c0c40

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -9
Dockerfile CHANGED
@@ -13,19 +13,14 @@ WORKDIR /code
13
  COPY requirements.txt /code/requirements.txt
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
- # Pre-download models to cache inside docker image
17
- RUN python3 -c "
18
- import os
19
- from huggingface_hub import snapshot_download
20
- MODEL_CACHE_DIR = '/code/models'
21
- snapshot_download(repo_id='FunAudioLLM/SenseVoiceSmall', local_dir=os.path.join(MODEL_CACHE_DIR, 'SenseVoiceSmall'), ignore_patterns=['*.onnx'])
22
- snapshot_download(repo_id='funasr/fsmn-vad', local_dir=os.path.join(MODEL_CACHE_DIR, 'fsmn-vad'), ignore_patterns=['*.onnx'])
23
- "
24
 
25
  # Copy application source
26
  COPY . /code
27
 
28
- # Change permissions of /code to run inside HF Space container
29
  RUN chmod -R 777 /code
30
 
31
  # Expose default port
 
13
  COPY requirements.txt /code/requirements.txt
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
+ # Copy download script and pre-cache models inside image
17
+ COPY download_models.py /code/download_models.py
18
+ RUN python3 /code/download_models.py
 
 
 
 
 
19
 
20
  # Copy application source
21
  COPY . /code
22
 
23
+ # Change permissions to run under non-root user in HF Spaces
24
  RUN chmod -R 777 /code
25
 
26
  # Expose default port