from audio_denoiser.AudioDenoiser import AudioDenoiser from timeit import default_timer as timer from datetime import datetime import gradio as gr from torchaudio import AudioMetaData import torch import tempfile import os,pytz tz = pytz.timezone('Asia/Singapore') theme='remilia/Ghostly' device = torch.device('cuda:0') if torch.cuda.is_available() else torch.device('cpu') def denoiser(win, auto_scale): if win is None: gr.Warning('Audio does not exist. Please ensure that the audio has been successfully uploaded.') return None,None startTime=timer() denoiser = AudioDenoiser(device=device) temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.wav') wout = temp_file.name temp_file.close() try: denoiser.process_audio_file(win, wout, auto_scale) except RuntimeError as e: gr.Warning(str(e)) return None,None endTime=timer() info=(f'🆗Completion time: {round(endTime-startTime,4)}s') now=datetime.now(tz).strftime('%H:%M:%S') print(f'{now}-{info}') return wout,info examples = [ ["sample/exp1.wav", "sample/exp1_d.wav"], ["sample/exp2.wav", "sample/exp2_d.wav"] ] with gr.Blocks(theme=theme) as app: gr.HTML('''
Originating from the project: audio-denoiser
model: jose-h-solorzano/audio-denoiser-512-32-v1