Nephele commited on
Commit
95991a4
1 Parent(s): 13795db

first_push

Browse files
Files changed (6) hide show
  1. .gitattributes +1 -0
  2. app.py +54 -0
  3. requirements.txt +3 -0
  4. sample/noise1.wav +3 -0
  5. sample/noise2.wav +3 -0
  6. sample/noise3.wav +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.wav filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from audio_denoiser.AudioDenoiser import AudioDenoiser
2
+ from timeit import default_timer as timer
3
+ import gradio as gr
4
+ from torchaudio import AudioMetaData
5
+ import torch
6
+ import tempfile
7
+ import os
8
+
9
+
10
+ theme='remilia/Ghostly'
11
+ device = torch.device('cuda:0') if torch.cuda.is_available() else torch.device('cpu')
12
+
13
+
14
+ def denoiser(win, auto_scale):
15
+ if win is None:
16
+ gr.Warning('Audio does not exist. Please ensure that the audio has been successfully uploaded.')
17
+ return None,None
18
+
19
+ startTime=timer()
20
+ denoiser = AudioDenoiser(device=device)
21
+ temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.wav')
22
+ wout = temp_file.name
23
+ temp_file.close()
24
+ denoiser.process_audio_file(win, wout, auto_scale)
25
+ endTime=timer()
26
+ info=(f'🆗Completion time: {round(endTime-startTime,4)}s')
27
+ return wout,info
28
+
29
+
30
+ with gr.Blocks(theme=theme) as app:
31
+ gr.HTML('''
32
+ <h1 style="font-size: 25px;">Audio Dnoiser</h1>
33
+ <p style="margin-bottom: 10px; font-size: 100%">
34
+
35
+ Originating from the project: <a href='https://github.com/jose-solorzano/audio-denoiser'>audio-denoiser</a><br>
36
+ model: <a href='https://huggingface.co/jose-h-solorzano/audio-denoiser-512-32-v1'>jose-h-solorzano/audio-denoiser-512-32-v1</a><br>
37
+
38
+ </p>''')
39
+ audio_in = gr.Audio(type="filepath", label="Upload Audio")
40
+ btn=gr.Button(value='💥Remove Noise')
41
+ scale = gr.Checkbox(
42
+ label="Auto Scale",
43
+ info='Recommended for low-volume input audio',
44
+ value=True,
45
+ )
46
+ audio_out = gr.Audio(type="filepath", label="Denoised Audio")
47
+ info=gr.Textbox(label='info')
48
+
49
+ btn.click(
50
+ denoiser,
51
+ inputs=[audio_in, scale],
52
+ outputs=[audio_out,info])
53
+
54
+ app.launch(share=True)
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ audio-denoiser
2
+ soundfile
3
+ torchaudio
sample/noise1.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad861d15fffc0a933a839cc4730b5e42d56a86084f686f130451c7134c8ed26f
3
+ size 438100
sample/noise2.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c8e4445aed300ec8954d00aed652fdc1043b6dcdbf9d896414125fa4b513a5b9
3
+ size 441044
sample/noise3.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b5664d57114d9d81d561919493b91fca1a994679fdbaec24ece60eb2fd406afa
3
+ size 790316