Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +21 -2
Dockerfile
CHANGED
|
@@ -6,15 +6,34 @@ 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; m = types.ModuleType('torchaudio.backend.common'); m.AudioMetaData =
|
| 10 |
|
| 11 |
RUN cat <<'EOF' > /app/app.py
|
| 12 |
import sys, types
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
m = types.ModuleType("torchaudio.backend.common")
|
| 14 |
-
m.AudioMetaData =
|
| 15 |
sys.modules.setdefault("torchaudio.backend", types.ModuleType("torchaudio.backend"))
|
| 16 |
sys.modules["torchaudio.backend.common"] = m
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
import gradio as gr
|
| 19 |
from df.enhance import enhance, init_df, load_audio, save_audio
|
| 20 |
|
|
|
|
| 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
|
| 14 |
+
|
| 15 |
+
class AudioMetaData:
|
| 16 |
+
pass
|
| 17 |
+
|
| 18 |
m = types.ModuleType("torchaudio.backend.common")
|
| 19 |
+
m.AudioMetaData = AudioMetaData
|
| 20 |
sys.modules.setdefault("torchaudio.backend", types.ModuleType("torchaudio.backend"))
|
| 21 |
sys.modules["torchaudio.backend.common"] = m
|
| 22 |
|
| 23 |
+
import torchaudio as ta
|
| 24 |
+
|
| 25 |
+
def _ta_info(file, **kwargs):
|
| 26 |
+
info = sf.info(file)
|
| 27 |
+
return types.SimpleNamespace(
|
| 28 |
+
sample_rate=info.samplerate,
|
| 29 |
+
num_frames=info.frames,
|
| 30 |
+
num_channels=info.channels,
|
| 31 |
+
bits_per_sample=16,
|
| 32 |
+
encoding="PCM_S",
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
ta.info = _ta_info
|
| 36 |
+
|
| 37 |
import gradio as gr
|
| 38 |
from df.enhance import enhance, init_df, load_audio, save_audio
|
| 39 |
|