ftshijt commited on
Commit
e43191e
·
1 Parent(s): 67347ea

update hf repo

Browse files
Files changed (2) hide show
  1. Dockerfile +8 -5
  2. app.py +3 -0
Dockerfile CHANGED
@@ -2,6 +2,8 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
 
 
5
  # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  git \
@@ -11,13 +13,12 @@ RUN apt-get update && apt-get install -y \
11
  && apt-get clean \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Create NLTK data directory with correct permissions
 
 
15
  RUN mkdir -p /usr/local/share/nltk_data && \
16
  chmod -R 777 /usr/local/share/nltk_data
17
 
18
- # Set NLTK_DATA environment variable
19
- ENV NLTK_DATA=/usr/local/share/nltk_data
20
-
21
  # Copy requirements file
22
  COPY requirements.txt .
23
 
@@ -49,10 +50,12 @@ RUN touch /app/versa/.installation_complete
49
 
50
  # Set port
51
  EXPOSE 7860
52
- ENV GRADIO_SERVER_NAME="0.0.0.0"
53
 
54
  # Set environment variables
 
 
55
  ENV PYTHONUNBUFFERED=1
 
56
 
57
  # Set for Numba cache (error from https://github.com/librosa/librosa/issues/1156)
58
  RUN mkdir -m 777 /tmp/NUMBA_CACHE_DIR /tmp/MPLCONFIGDIR
 
2
 
3
  WORKDIR /app
4
 
5
+
6
+
7
  # Install system dependencies
8
  RUN apt-get update && apt-get install -y \
9
  git \
 
13
  && apt-get clean \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
+ # Create and set permissions for cache directories
17
+ RUN mkdir -p /.cache && chmod 777 /.cache
18
+ RUN mkdir -p /root/.cache && chmod 777 /root/.cache
19
  RUN mkdir -p /usr/local/share/nltk_data && \
20
  chmod -R 777 /usr/local/share/nltk_data
21
 
 
 
 
22
  # Copy requirements file
23
  COPY requirements.txt .
24
 
 
50
 
51
  # Set port
52
  EXPOSE 7860
 
53
 
54
  # Set environment variables
55
+ ENV GRADIO_SERVER_NAME="0.0.0.0"
56
+ ENV NLTK_DATA=/usr/local/share/nltk_data
57
  ENV PYTHONUNBUFFERED=1
58
+ ENV HF_HOME=/root/.cache/huggingface
59
 
60
  # Set for Numba cache (error from https://github.com/librosa/librosa/issues/1156)
61
  RUN mkdir -m 777 /tmp/NUMBA_CACHE_DIR /tmp/MPLCONFIGDIR
app.py CHANGED
@@ -329,6 +329,9 @@ def evaluate_audio(gt_file, pred_file, metric_config, include_timestamps=False):
329
  # Pass through the NLTK_DATA environment variable
330
  env["NLTK_DATA"] = nltk_data_dir
331
 
 
 
 
332
  process = subprocess.run(
333
  cmd,
334
  check=True,
 
329
  # Pass through the NLTK_DATA environment variable
330
  env["NLTK_DATA"] = nltk_data_dir
331
 
332
+ # Set huggingface cache
333
+ env["HF_HOME"] = "/root/.cache/huggingface"
334
+
335
  process = subprocess.run(
336
  cmd,
337
  check=True,