Spaces:
Running
Running
Hendrik Schroeter
commited on
Commit
•
b8708f4
1
Parent(s):
4c088ad
Init matplotlib in main thread
Browse files
app.py
CHANGED
@@ -21,6 +21,11 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
21 |
model, df, _ = init_df("./DeepFilterNet2", config_allow_defaults=True)
|
22 |
model = model.to(device=device).eval()
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
NOISES = {
|
25 |
"None": None,
|
26 |
"Kitchen": "samples/dkitchen.wav",
|
@@ -130,9 +135,9 @@ def demo_fn(
|
|
130 |
logger.info(f"saved audios: {noisy_fn}, {enhanced_fn}")
|
131 |
return (
|
132 |
noisy_fn,
|
133 |
-
spec_figure(sample, sr=sr),
|
134 |
enhanced_fn,
|
135 |
-
spec_figure(enhanced, sr=sr),
|
136 |
)
|
137 |
|
138 |
|
@@ -260,10 +265,10 @@ inputs = [
|
|
260 |
),
|
261 |
]
|
262 |
outputs = [
|
263 |
-
gradio.outputs.Audio(label="Noisy"),
|
264 |
-
gradio.outputs.Image(type="plot"),
|
265 |
-
gradio.outputs.Audio(label="Enhanced"),
|
266 |
-
gradio.outputs.Image(type="plot"),
|
267 |
]
|
268 |
description = "This demo denoises audio files using DeepFilterNet. Try it with your own voice!"
|
269 |
iface = gradio.Interface(
|
|
|
21 |
model, df, _ = init_df("./DeepFilterNet2", config_allow_defaults=True)
|
22 |
model = model.to(device=device).eval()
|
23 |
|
24 |
+
fig_noisy, ax_noisy = plt.subplots(figsize=(15.2, 5))
|
25 |
+
fig_noisy.set_tight_layout(True)
|
26 |
+
fig_enh, ax_enh = plt.subplots(figsize=(15.2, 5))
|
27 |
+
fig_enh.set_tight_layout(True)
|
28 |
+
|
29 |
NOISES = {
|
30 |
"None": None,
|
31 |
"Kitchen": "samples/dkitchen.wav",
|
|
|
135 |
logger.info(f"saved audios: {noisy_fn}, {enhanced_fn}")
|
136 |
return (
|
137 |
noisy_fn,
|
138 |
+
spec_figure(sample, sr=sr, figure=fig_noisy, ax=ax_noisy),
|
139 |
enhanced_fn,
|
140 |
+
spec_figure(enhanced, sr=sr, figure=fig_enh, ax=ax_enh),
|
141 |
)
|
142 |
|
143 |
|
|
|
265 |
),
|
266 |
]
|
267 |
outputs = [
|
268 |
+
gradio.outputs.Audio(label="Noisy audio"),
|
269 |
+
gradio.outputs.Image(type="plot", label="Noisy spectrogram"),
|
270 |
+
gradio.outputs.Audio(label="Enhanced audio"),
|
271 |
+
gradio.outputs.Image(type="plot", label="Enhanced spectrogram"),
|
272 |
]
|
273 |
description = "This demo denoises audio files using DeepFilterNet. Try it with your own voice!"
|
274 |
iface = gradio.Interface(
|