Spaces:
Runtime error
Runtime error
File size: 887 Bytes
091b1e0 bd0a813 091b1e0 bd0a813 091b1e0 bd0a813 091b1e0 e2b0b28 091b1e0 bd0a813 091b1e0 bd0a813 091b1e0 bd0a813 091b1e0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import sys
import os
from re import M
import uuid
import shutil
import ffmpeg
import logging
import gradio as gr
from denoisers.SpectralGating import SpectralGating
model = SpectralGating()
def denoising_transform(audio):
src_path = "cache_wav/original/{}.wav".format(str(uuid.uuid4()))
tgt_path = "cache_wav/denoised/{}.wav".format(str(uuid.uuid4()))
(ffmpeg.input(audio)
.output(src_path, acodec='pcm_s16le', ac=1, ar=22050)
.run()
)
model.predict(audio, tgt_path)
return tgt_path
inputs = gr.inputs.Audio(label="Source Audio", source="microphone", type='filepath')
outputs = gr.outputs.Audio(label="Target Audio", type='filepath')
title = "Denoising"
gr.Interface(
denoising_transform, inputs, outputs, title=title,
allow_flagging='never'
).launch(
server_name='localhost',
server_port=7871,
share=True
)
|