nirkyy commited on
Commit
8a64199
·
verified ·
1 Parent(s): 1ebc568

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +3 -2
Dockerfile CHANGED
@@ -1,3 +1,4 @@
 
1
  FROM python:3.10-slim
2
 
3
  WORKDIR /app
@@ -6,8 +7,6 @@ RUN apt-get update && apt-get install -y ffmpeg libsndfile1 git && rm -rf /var/l
6
  RUN pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu torch torchaudio
7
  RUN pip install --no-cache-dir deepfilternet gradio soundfile
8
 
9
- RUN python -c "import sys, types, soundfile as sf; m = types.ModuleType('torchaudio.backend.common'); class Meta: pass; m.AudioMetaData = Meta; sys.modules.setdefault('torchaudio.backend', types.ModuleType('torchaudio.backend')); sys.modules['torchaudio.backend.common'] = m; import torchaudio as ta; ta.info = lambda f, **kw: types.SimpleNamespace(sample_rate=sf.info(f).samplerate, num_frames=sf.info(f).frames, num_channels=sf.info(f).channels, bits_per_sample=16, encoding='PCM_S'); from df.enhance import init_df; init_df()"
10
-
11
  RUN cat <<'EOF' > /app/app.py
12
  import sys, types
13
  import soundfile as sf
@@ -59,6 +58,8 @@ if __name__ == "__main__":
59
  demo.launch(server_name="0.0.0.0", server_port=7860)
60
  EOF
61
 
 
 
62
  EXPOSE 7860
63
 
64
  CMD ["python", "/app/app.py"]
 
1
+
2
  FROM python:3.10-slim
3
 
4
  WORKDIR /app
 
7
  RUN pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu torch torchaudio
8
  RUN pip install --no-cache-dir deepfilternet gradio soundfile
9
 
 
 
10
  RUN cat <<'EOF' > /app/app.py
11
  import sys, types
12
  import soundfile as sf
 
58
  demo.launch(server_name="0.0.0.0", server_port=7860)
59
  EOF
60
 
61
+ RUN python -c "import runpy; runpy.run_path('/app/app.py')" --help 2>/dev/null || python -c "import sys, types, soundfile as sf; sys.modules.setdefault('torchaudio.backend', types.ModuleType('torchaudio.backend')); m=types.ModuleType('torchaudio.backend.common'); m.AudioMetaData=object; sys.modules['torchaudio.backend.common']=m; import torchaudio as ta; ta.info=lambda f,**k: types.SimpleNamespace(sample_rate=sf.info(f).samplerate, num_frames=sf.info(f).frames, num_channels=sf.info(f).channels, bits_per_sample=16, encoding='PCM_S'); from df.enhance import init_df; init_df()"
62
+
63
  EXPOSE 7860
64
 
65
  CMD ["python", "/app/app.py"]