Yuekai Zhang commited on
Commit
dde9123
·
1 Parent(s): e8bec2d
Files changed (3) hide show
  1. Dockerfile +1 -1
  2. Dockerfile.origin +2 -15
  3. app.py +1 -1
Dockerfile CHANGED
@@ -1 +1 @@
1
- FROM soar97/torch-paraformer-gradio:22.12
 
1
+ FROM soar97/torch-paraformer-gradio:22.12.1
Dockerfile.origin CHANGED
@@ -4,23 +4,10 @@ ENV DEBIAN_FRONTEND=noninteractive
4
 
5
  RUN apt-get update && apt-get install -y ffmpeg
6
 
7
- COPY ./requirements-gradio.txt ./
8
 
9
  RUN pip install --no-cache-dir --upgrade -r ./requirements-gradio.txt
10
 
11
- # Set up a new user named "user" with user ID 1000
12
- RUN useradd -m -u 1000 user
13
- # Switch to the "user" user
14
- USER user
15
- # Set home to the user's home directory
16
- ENV HOME=/home/user \
17
- PATH=/home/user/.local/bin:$PATH
18
-
19
- # Set the working directory to the user's home directory
20
- WORKDIR $HOME/app
21
-
22
- # Copy the current directory contents into the container at $HOME/app setting the owner to the user
23
- COPY --chown=user app.py $HOME/app/
24
- COPY --chown=user --from=soar97/torch-paraformer:22.12 /workspace/ $HOME/app/
25
 
26
  CMD ["python", "app.py"]
 
4
 
5
  RUN apt-get update && apt-get install -y ffmpeg
6
 
7
+ COPY ./requirements-gradio.txt app.py ./
8
 
9
  RUN pip install --no-cache-dir --upgrade -r ./requirements-gradio.txt
10
 
11
+ RUN chmod -R 777 /workspace/*
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  CMD ["python", "app.py"]
app.py CHANGED
@@ -12,7 +12,7 @@ def convert_to_wav(in_filename: str) -> str:
12
  """Convert the input audio file to a wave file"""
13
  out_filename = in_filename + ".wav"
14
  if '.mp3' in in_filename:
15
- os.system(f"ffmpeg -y -i '{in_filename}' -acodec pcm_s16le -ac 1 -ar 16000 '{out_filename}'")
16
  else:
17
  _ = os.system(f"ffmpeg -hide_banner -y -i '{in_filename}' -ar 16000 '{out_filename}'")
18
  speech, _ = soundfile.read(out_filename)
 
12
  """Convert the input audio file to a wave file"""
13
  out_filename = in_filename + ".wav"
14
  if '.mp3' in in_filename:
15
+ _ = os.system(f"ffmpeg -y -i '{in_filename}' -acodec pcm_s16le -ac 1 -ar 16000 '{out_filename}'")
16
  else:
17
  _ = os.system(f"ffmpeg -hide_banner -y -i '{in_filename}' -ar 16000 '{out_filename}'")
18
  speech, _ = soundfile.read(out_filename)