Spaces:
Runtime error
Runtime error
Commit
·
f6561a5
1
Parent(s):
1533e68
rewrite app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,9 @@
|
|
| 1 |
import uuid
|
| 2 |
import ffmpeg
|
| 3 |
import gradio as gr
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
from denoisers.SpectralGating import SpectralGating
|
| 8 |
|
| 9 |
-
model = SpectralGating()
|
| 10 |
-
|
| 11 |
|
| 12 |
def denoising_transform(audio):
|
| 13 |
src_path = "cache_wav/original/{}.wav".format(str(uuid.uuid4()))
|
|
@@ -20,15 +16,19 @@ def denoising_transform(audio):
|
|
| 20 |
return tgt_path
|
| 21 |
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
|
|
|
| 26 |
|
| 27 |
-
title = "Denoising"
|
| 28 |
-
gr.Interface(
|
| 29 |
-
denoising_transform, inputs, outputs, title=title,
|
| 30 |
-
allow_flagging='never'
|
| 31 |
-
).launch(
|
| 32 |
-
# server_name='localhost',
|
| 33 |
-
# server_port=7871
|
| 34 |
-
)
|
|
|
|
| 1 |
import uuid
|
| 2 |
import ffmpeg
|
| 3 |
import gradio as gr
|
| 4 |
+
from pathlib import Path
|
|
|
|
|
|
|
| 5 |
from denoisers.SpectralGating import SpectralGating
|
| 6 |
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def denoising_transform(audio):
|
| 9 |
src_path = "cache_wav/original/{}.wav".format(str(uuid.uuid4()))
|
|
|
|
| 16 |
return tgt_path
|
| 17 |
|
| 18 |
|
| 19 |
+
demo = gr.Interface(
|
| 20 |
+
fn=denoising_transform,
|
| 21 |
+
inputs=gr.Audio(label="Source Audio", source="microphone", type='filepath'),
|
| 22 |
+
outputs=gr.Audio(label="Target Audio", type='filepath'),
|
| 23 |
+
examples=[
|
| 24 |
+
["testing/wavs/p232_071.wav"],
|
| 25 |
+
["testing/wavs/p232_284.wav"],
|
| 26 |
+
],
|
| 27 |
+
title="Denoising",
|
| 28 |
+
interpretation="default",
|
| 29 |
+
)
|
| 30 |
|
| 31 |
+
if __name__ == "__main__":
|
| 32 |
+
model = SpectralGating()
|
| 33 |
+
demo.launch()
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|